Commit dd794625 by Leonard Gram Committed by GitHub

API: adds redirect helper to simplify http redirects (#19180)

parent 75bf31b5
......@@ -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}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment