gophertype/pkg/responses/redirect.go

10 lines
206 B
Go
Raw Normal View History

2019-11-26 03:55:28 +00:00
package responses
import "net/http"
// Redirect to a different URL.
func Redirect(w http.ResponseWriter, r *http.Request, url string) {
w.Header().Set("Location", url)
w.WriteHeader(http.StatusFound)
}