Trim trailing slash from Handler patterns

This commit is contained in:
adnano 2020-09-27 21:24:08 -04:00
parent 3428a006ba
commit 5a0f7cf631

View File

@ -284,6 +284,10 @@ func (m *ServeMux) Handle(pattern string, handler Handler) {
if err != nil {
panic(err)
}
// Trim trailing slash from URL path
if len(url.Path) != 0 && url.Path[len(url.Path)-1] == '/' {
url.Path = url.Path[:len(url.Path)-1]
}
e := muxEntry{
url,
handler,