From a7cfb9f2c3dc239e06e07921d4ebc05252859381 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Wed, 27 Jan 2021 22:46:22 +0100 Subject: [PATCH] Fix JSON Header response (#14499) --- modules/context/context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/context/context.go b/modules/context/context.go index d02339d5b0..adae562c0a 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -356,8 +356,8 @@ func (ctx *Context) Error(status int, contents ...string) { // JSON render content as JSON func (ctx *Context) JSON(status int, content interface{}) { - ctx.Resp.WriteHeader(status) ctx.Resp.Header().Set("Content-Type", "application/json;charset=utf8") + ctx.Resp.WriteHeader(status) if err := json.NewEncoder(ctx.Resp).Encode(content); err != nil { ctx.ServerError("Render JSON failed", err) }