From 5a0f7cf631bee7ba02aae8ec87794626d61afc62 Mon Sep 17 00:00:00 2001 From: adnano Date: Sun, 27 Sep 2020 21:24:08 -0400 Subject: [PATCH] Trim trailing slash from Handler patterns --- server.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server.go b/server.go index 1bc9197..8187e71 100644 --- a/server.go +++ b/server.go @@ -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,