1
0
mirror of https://github.com/astaxie/beego.git synced 2024-06-01 08:53:28 +00:00
Beego/context/httpResponse/response.go
2017-05-18 10:32:51 +03:00

30 lines
545 B
Go

package httpResponse
import (
"strconv"
"net/http"
beecontext "github.com/astaxie/beego/context"
)
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 *beecontext.Context) {
ctx.Output.SetStatus(int(s))
}