mirror of https://github.com/gofiber/fiber.git
parent
9bbadddbb2
commit
2d6323c197
|
@ -34,7 +34,7 @@ func New() fiber.Handler {
|
||||||
}
|
}
|
||||||
// Switch to original path without stripped slashes
|
// Switch to original path without stripped slashes
|
||||||
switch path {
|
switch path {
|
||||||
case "/debug/pprof":
|
case "/debug/pprof/":
|
||||||
pprofIndex(c.Context())
|
pprofIndex(c.Context())
|
||||||
case "/debug/pprof/cmdline":
|
case "/debug/pprof/cmdline":
|
||||||
pprofCmdline(c.Context())
|
pprofCmdline(c.Context())
|
||||||
|
@ -61,7 +61,7 @@ func New() fiber.Handler {
|
||||||
if strings.HasSuffix(path, "/") {
|
if strings.HasSuffix(path, "/") {
|
||||||
path = strings.TrimRight(path, "/")
|
path = strings.TrimRight(path, "/")
|
||||||
} else {
|
} else {
|
||||||
path = "/debug/pprof"
|
path = "/debug/pprof/"
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.Redirect(path, fiber.StatusFound)
|
return c.Redirect(path, fiber.StatusFound)
|
||||||
|
|
|
@ -37,7 +37,7 @@ func Test_Pprof_Index(t *testing.T) {
|
||||||
return c.SendString("escaped")
|
return c.SendString("escaped")
|
||||||
})
|
})
|
||||||
|
|
||||||
resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/debug/pprof", nil))
|
resp, err := app.Test(httptest.NewRequest(fiber.MethodGet, "/debug/pprof/", nil))
|
||||||
utils.AssertEqual(t, nil, err)
|
utils.AssertEqual(t, nil, err)
|
||||||
utils.AssertEqual(t, 200, resp.StatusCode)
|
utils.AssertEqual(t, 200, resp.StatusCode)
|
||||||
utils.AssertEqual(t, fiber.MIMETextHTMLCharsetUTF8, resp.Header.Get(fiber.HeaderContentType))
|
utils.AssertEqual(t, fiber.MIMETextHTMLCharsetUTF8, resp.Header.Get(fiber.HeaderContentType))
|
||||||
|
|
Loading…
Reference in New Issue