1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-14 06:40:55 +00:00
Beego/server/web/context/response.go
Ming Deng 14c1b76569 remove pkg directory;
remove build directory;
remove githook directory;
2020-10-08 18:29:36 +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))
}