mirror of
https://github.com/cubixle/tuu.git
synced 2026-04-24 19:54:46 +01:00
added redirect to context
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/gobuffalo/buffalo/render"
|
||||
)
|
||||
|
||||
@@ -15,4 +16,5 @@ type Context interface {
|
||||
Param(key string) string
|
||||
Set(key string, value interface{})
|
||||
Render(status int, rr render.Renderer) error
|
||||
Redirect(status int, url string) error
|
||||
}
|
||||
|
||||
@@ -106,3 +106,8 @@ func (d *DefaultContext) Render(status int, rr render.Renderer) error {
|
||||
d.Response().WriteHeader(status)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *DefaultContext) Redirect(status int, url string) error {
|
||||
http.Redirect(d.Response(), d.Request(), url, status)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user