Remove Redirect and PermanentRedirect functions

Use (*ResponseWriter).WriteHeader instead.
This commit is contained in:
Adnan Maolood
2020-10-31 16:51:10 -04:00
parent ca8e0166fc
commit 63b9b484d1
4 changed files with 6 additions and 16 deletions

4
mux.go
View File

@@ -138,14 +138,14 @@ func (mux *ServeMux) Respond(w *ResponseWriter, r *Request) {
// If the given path is /tree and its handler is not registered,
// redirect for /tree/.
if u, ok := mux.redirectToPathSlash(path, r.URL); ok {
Redirect(w, u.String())
w.WriteHeader(StatusRedirect, u.String())
return
}
if path != r.URL.Path {
u := *r.URL
u.Path = path
Redirect(w, u.String())
w.WriteHeader(StatusRedirect, u.String())
return
}