瀏覽代碼

fix json encode

fancl 7 月之前
父節點
當前提交
be8b56b897
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      entry/http/context.go

+ 1 - 0
entry/http/context.go

@@ -122,6 +122,7 @@ func (ctx *Context) Param(k string) string {
 func (ctx *Context) json(res responsePayload) (err error) {
 	ctx.Response().Header().Set("Content-Type", "application/json")
 	encoder := json.NewEncoder(ctx.Response())
+	encoder.SetEscapeHTML(false)
 	if strings.HasPrefix(ctx.Request().Header.Get("User-Agent"), "curl") {
 		encoder.SetIndent("", "\t")
 	}