Merge branch 'master' into master-readme

This commit is contained in:
thinkerou 2019-06-28 09:25:30 +08:00 committed by GitHub
commit ffa5d3a45a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1119,8 +1119,8 @@ Using JSONP to request data from a server in a different domain. Add callback t
func main() {
r := gin.Default()
r.GET("/JSONP?callback=x", func(c *gin.Context) {
data := map[string]interface{}{
r.GET("/JSONP", func(c *gin.Context) {
data := gin.H{
"foo": "bar",
}
@ -1131,6 +1131,9 @@ func main() {
// Listen and serve on 0.0.0.0:8080
r.Run(":8080")
// client
// curl http://127.0.0.1:8080/JSONP?callback=x
}
```
@ -1143,7 +1146,7 @@ func main() {
r := gin.Default()
r.GET("/someJSON", func(c *gin.Context) {
data := map[string]interface{}{
data := gin.H{
"lang": "GO语言",
"tag": "<br>",
}
@ -1352,7 +1355,7 @@ func main() {
router.LoadHTMLFiles("./testdata/template/raw.tmpl")
router.GET("/raw", func(c *gin.Context) {
c.HTML(http.StatusOK, "raw.tmpl", map[string]interface{}{
c.HTML(http.StatusOK, "raw.tmpl", gin.H{
"now": time.Date(2017, 07, 01, 0, 0, 0, 0, time.UTC),
})
})