mirror of
https://github.com/grafana/grafana.git
synced 2024-11-28 03:34:15 -06:00
API: adds redirect helper to simplify http redirects (#19180)
This commit is contained in:
parent
75bf31b5c7
commit
dd794625dd
@ -135,3 +135,15 @@ func Respond(status int, body interface{}) *NormalResponse {
|
||||
header: make(http.Header),
|
||||
}
|
||||
}
|
||||
|
||||
type RedirectResponse struct {
|
||||
location string
|
||||
}
|
||||
|
||||
func (r *RedirectResponse) WriteTo(ctx *m.ReqContext) {
|
||||
ctx.Redirect(r.location)
|
||||
}
|
||||
|
||||
func Redirect(location string) *RedirectResponse {
|
||||
return &RedirectResponse{location: location}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user