1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-23 21:30:55 +00:00
Beego/server/web/context/response.go
Ming Deng debd68cbe4 Revert "Merge pull request #4325 from flycash/revert1"
This reverts commit fad897346f, reversing
changes made to e284b0ddae.
2020-12-12 21:28:58 +08:00

27 lines
480 B
Go

package context
import (
"net/http"
"strconv"
)
const (
//BadRequest indicates HTTP error 400
BadRequest StatusCode = http.StatusBadRequest
//NotFound indicates HTTP error 404
NotFound StatusCode = http.StatusNotFound
)
// StatusCode sets the HTTP response status code
type StatusCode int
func (s StatusCode) Error() string {
return strconv.Itoa(int(s))
}
// Render sets the HTTP status code
func (s StatusCode) Render(ctx *Context) {
ctx.Output.SetStatus(int(s))
}