mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 06:32:17 +08:00
API: adds redirect helper to simplify http redirects (#19180)
This commit is contained in:
@ -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}
|
||||
}
|
||||
|
Reference in New Issue
Block a user