6543
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
1 additions and
1 deletions
-
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) |
|
|
|
} |
|
|
|