Golang Gin 设置不同类型的响应返回值:修订历史

本页内容

差异选择:选中要对比的版本的单选按钮,按Enter键或下方的按钮。
说明:(当前)=与最后版本之间的差异,(之前)=与上一版本之间的差异,=小编辑。

2022年9月27日 (星期二)

  • 当前之前 17:522022年9月27日 (二) 17:52Neo 讨论 贡献 5,094字节 +5,094 创建页面,内容为“== AsciiJSON == 使用 AsciiJSON 生成具有转义的非 ASCII 字符的 ASCII-only JSON。 <sample title="" desc="" > func main() { r := gin.Default() r.GET("/someJSON", func(c *gin.Context) { data := map[string]interface{}{ "lang": "GO语言", "tag": "<br>", } // 输出 : {"lang":"GO\u8bed\u8a00","tag":"\u003cbr\u003e"} c.AsciiJSON(http.StatusOK, data) }) // 监听并在 0.0.0.0:8080 上启动服务 r.Run(":8080") } </sample> == JSONP…”