mirror of https://github.com/gin-gonic/gin.git
docs: trimmed some white spaces (#4070)
This commit is contained in:
parent
b080116a7f
commit
299c6f30e3
|
@ -172,7 +172,7 @@ func main() {
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
|
|
||||||
// Query string parameters are parsed using the existing underlying request object.
|
// Query string parameters are parsed using the existing underlying request object.
|
||||||
// The request responds to an url matching: /welcome?firstname=Jane&lastname=Doe
|
// The request responds to an url matching: /welcome?firstname=Jane&lastname=Doe
|
||||||
router.GET("/welcome", func(c *gin.Context) {
|
router.GET("/welcome", func(c *gin.Context) {
|
||||||
firstname := c.DefaultQuery("firstname", "Guest")
|
firstname := c.DefaultQuery("firstname", "Guest")
|
||||||
lastname := c.Query("lastname") // shortcut for c.Request.URL.Query().Get("lastname")
|
lastname := c.Query("lastname") // shortcut for c.Request.URL.Query().Get("lastname")
|
||||||
|
@ -615,7 +615,7 @@ You can also specify that specific fields are required. If a field is decorated
|
||||||
```go
|
```go
|
||||||
// Binding from JSON
|
// Binding from JSON
|
||||||
type Login struct {
|
type Login struct {
|
||||||
User string `form:"user" json:"user" xml:"user" binding:"required"`
|
User string `form:"user" json:"user" xml:"user" binding:"required"`
|
||||||
Password string `form:"password" json:"password" xml:"password" binding:"required"`
|
Password string `form:"password" json:"password" xml:"password" binding:"required"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1252,7 +1252,7 @@ func main() {
|
||||||
|
|
||||||
#### JSONP
|
#### JSONP
|
||||||
|
|
||||||
Using JSONP to request data from a server in a different domain. Add callback to response body if the query parameter callback exists.
|
Using JSONP to request data from a server in a different domain. Add callback to response body if the query parameter callback exists.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -1301,7 +1301,7 @@ func main() {
|
||||||
|
|
||||||
#### PureJSON
|
#### PureJSON
|
||||||
|
|
||||||
Normally, JSON replaces special HTML characters with their unicode entities, e.g. `<` becomes `\u003c`. If you want to encode such characters literally, you can use PureJSON instead.
|
Normally, JSON replaces special HTML characters with their unicode entities, e.g. `<` becomes `\u003c`. If you want to encode such characters literally, you can use PureJSON instead.
|
||||||
This feature is unavailable in Go 1.6 and lower.
|
This feature is unavailable in Go 1.6 and lower.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
|
|
Loading…
Reference in New Issue