1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 02:30:55 +00:00

remove Redirect to avoid confusion

This commit is contained in:
Eyal Post 2017-05-18 10:32:51 +03:00
parent 3e51823c0f
commit 2513bcf584

View File

@ -16,13 +16,6 @@ const (
NotFound StatusCode = http.StatusNotFound
)
// Redirect renders http 302 with a URL
func Redirect(localurl string) error {
return statusCodeWithRender{302, func(ctx *beecontext.Context) {
ctx.Redirect(302, localurl)
}}
}
// StatusCode sets the http response status code
type StatusCode int
@ -34,19 +27,3 @@ func (s StatusCode) Error() string {
func (s StatusCode) Render(ctx *beecontext.Context) {
ctx.Output.SetStatus(int(s))
}
type statusCodeWithRender struct {
statusCode int
f func(ctx *beecontext.Context)
}
//assert that statusCodeWithRender implements Renderer interface
var _r beecontext.Renderer = (*statusCodeWithRender)(nil)
func (s statusCodeWithRender) Error() string {
return strconv.Itoa(s.statusCode)
}
func (s statusCodeWithRender) Render(ctx *beecontext.Context) {
s.f(ctx)
}