diff options
author | 6543 <6543@obermui.de> | 2021-01-27 22:46:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-27 15:46:22 -0600 |
commit | a7cfb9f2c3dc239e06e07921d4ebc05252859381 (patch) | |
tree | 5fcab4115ef711b2de2cfdf69657a556bccfd813 /modules | |
parent | fe5266a25b16c45660388ed51cb8f17945509596 (diff) | |
download | gitea-a7cfb9f2c3dc239e06e07921d4ebc05252859381.tar.gz gitea-a7cfb9f2c3dc239e06e07921d4ebc05252859381.zip |
Fix JSON Header response (#14499)
Diffstat (limited to 'modules')
-rw-r--r-- | modules/context/context.go | 2 |
1 files changed, 1 insertions, 1 deletions
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) } |