fixup redirect
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
3e30960694
commit
76dcf3af67
@ -15,7 +15,7 @@ func NewHandler(prefixPath string, initFuncs ...func()) http.HandlerFunc {
|
|||||||
|
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
switch {
|
switch {
|
||||||
case strings.EqualFold(r.RequestURI, prefixPath) && r.RequestURI[len(r.RequestURI)] != '/':
|
case strings.EqualFold(r.RequestURI, prefixPath) && r.RequestURI[len(r.RequestURI)-1] != '/':
|
||||||
http.Redirect(w, r, r.RequestURI+"/", http.StatusMovedPermanently)
|
http.Redirect(w, r, r.RequestURI+"/", http.StatusMovedPermanently)
|
||||||
case strings.HasPrefix(r.RequestURI, path.Join(prefixPath, "cmdline")):
|
case strings.HasPrefix(r.RequestURI, path.Join(prefixPath, "cmdline")):
|
||||||
pprof.Cmdline(w, r)
|
pprof.Cmdline(w, r)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user