diff --git a/middleware/go18.go b/middleware/go18.go deleted file mode 100644 index 1bf4939..0000000 --- a/middleware/go18.go +++ /dev/null @@ -1,10 +0,0 @@ -//go:build go1.8 -// +build go1.8 - -package middleware - -import "net/url" - -func pathUnescape(path string) (string, error) { - return url.PathUnescape(path) -} diff --git a/middleware/pre_go18.go b/middleware/pre_go18.go deleted file mode 100644 index 0338525..0000000 --- a/middleware/pre_go18.go +++ /dev/null @@ -1,9 +0,0 @@ -// +build !go1.8 - -package middleware - -import "net/url" - -func pathUnescape(path string) (string, error) { - return url.QueryUnescape(path) -} diff --git a/middleware/router.go b/middleware/router.go index 46b8f87..f7b5869 100644 --- a/middleware/router.go +++ b/middleware/router.go @@ -17,6 +17,7 @@ package middleware import ( "fmt" "net/http" + "net/url" fpath "path" "regexp" "strings" @@ -334,7 +335,7 @@ func (d *defaultRouter) Lookup(method, path string) (*MatchedRoute, bool) { debugLog("found a route for %s %s with %d parameters", method, path, len(entry.Parameters)) var params RouteParams for _, p := range rp { - v, err := pathUnescape(p.Value) + v, err := url.PathUnescape(p.Value) if err != nil { debugLog("failed to escape %q: %v", p.Value, err) v = p.Value