1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-13 21:11:02 +00:00

move to context

This commit is contained in:
Eyal Post
2017-05-18 10:38:12 +03:00
parent 2513bcf584
commit 11b4bf8aaa

27
context/response.go Normal file
View File

@ -0,0 +1,27 @@
package context
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
func (s StatusCode) Render(ctx *Context) {
ctx.Output.SetStatus(int(s))
}