➡️️ Redirect
The Redirect response takes a status code and an url, where the requester should be redirected to.
func Redirect(code int, url string) Response {
return &redirectResponse{code: code, url: url}
}
type redirectResponse struct {
code int
url string
}
func (j redirectResponse) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
http.Redirect(rw, r, j.url, j.code)
}