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

28 lines
481 B
Go
Raw Normal View History

2017-05-18 07:38:12 +00:00
package context
2017-05-17 17:38:59 +00:00
import (
"strconv"
"net/http"
)
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
2017-05-18 07:38:12 +00:00
func (s StatusCode) Render(ctx *Context) {
2017-05-17 17:38:59 +00:00
ctx.Output.SetStatus(int(s))
}