pull/1364/head
bestgopher 2021-06-03 22:02:17 +08:00 committed by GitHub
parent 9bbadddbb2
commit 2d6323c197
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -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)

View File

@ -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))