Skip to content

Commit 1cc4859

Browse files
committed
use http.StatusXXX constants
1 parent 8a32e50 commit 1cc4859

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/context/base.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ func (ctx *BaseContext) JSON(status int, content interface{}) {
172172
ctx.Resp.WriteHeader(status)
173173
if err := json.NewEncoder(ctx.Resp).Encode(content); err != nil {
174174
log.Error("Render JSON failed: %v", err)
175-
ctx.Status(500)
175+
ctx.Status(http.StatusInternalServerError)
176176
}
177177
}
178178

@@ -182,7 +182,7 @@ func (ctx *BaseContext) PlainText(status int, bs []byte) {
182182
ctx.Resp.Header().Set("Content-Type", "text/plain;charset=utf-8")
183183
if _, err := ctx.Resp.Write(bs); err != nil {
184184
log.Error("Render PlainText failed: %v", err)
185-
ctx.Status(500)
185+
ctx.Status(http.StatusInternalServerError)
186186
}
187187
}
188188

0 commit comments

Comments
 (0)