1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-23 17:20:55 +00:00
Beego/context/response.go

28 lines
481 B
Go
Raw Normal View History

2020-09-02 12:36:53 +00:00
package context
import (
"strconv"
"net/http"
2020-09-02 12:36:53 +00:00
)
const (
//BadRequest indicates http error 400
2020-09-02 12:36:53 +00:00
BadRequest StatusCode = http.StatusBadRequest
//NotFound indicates http error 404
2020-09-02 12:36:53 +00:00
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))
}