Skip to content

Commit a7cfb9f

Browse files
authored
Fix JSON Header response (#14499)
1 parent fe5266a commit a7cfb9f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/context/context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ func (ctx *Context) Error(status int, contents ...string) {
356356

357357
// JSON render content as JSON
358358
func (ctx *Context) JSON(status int, content interface{}) {
359-
ctx.Resp.WriteHeader(status)
360359
ctx.Resp.Header().Set("Content-Type", "application/json;charset=utf8")
360+
ctx.Resp.WriteHeader(status)
361361
if err := json.NewEncoder(ctx.Resp).Encode(content); err != nil {
362362
ctx.ServerError("Render JSON failed", err)
363363
}

0 commit comments

Comments
 (0)