From 11231c0e9337c22ea679a8a2a9f927cda3bf85c7 Mon Sep 17 00:00:00 2001 From: Francesco Mari Date: Fri, 17 Dec 2021 12:47:15 +0100 Subject: [PATCH] Remove the flag from UnescapeVars --- mux.go | 8 ++++---- mux_test.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mux.go b/mux.go index e7abb47..83be585 100644 --- a/mux.go +++ b/mux.go @@ -269,10 +269,10 @@ func (r *Router) SkipClean(value bool) *Router { // For example, if the router is configured only with UseEncodedPath(), and // "/path/foo%2Fbar/to" matches the path template "/path/{var}/to", your handler // will receive the value "foo%2Fbar" for the variable "var". Instead, if the -// router is configured with both UseEncodedPath() and UnescapeVars(true), the -// value for the variable "var" will be "foo/bar". -func (r *Router) UnescapeVars(value bool) *Router { - r.unescapeVars = value +// router is configured with both UseEncodedPath() and UnescapeVars(), the value +// for the variable "var" will be "foo/bar". +func (r *Router) UnescapeVars() *Router { + r.unescapeVars = true return r } diff --git a/mux_test.go b/mux_test.go index 0f3d223..fbee209 100644 --- a/mux_test.go +++ b/mux_test.go @@ -1553,7 +1553,7 @@ func TestUseEncodedPath(t *testing.T) { }, { title: "Router with useEncodedPath, URL with encoded slash does match, variables decoded", - route: NewRouter().UseEncodedPath().UnescapeVars(true).NewRoute().Path("/v1/{v1}/v2"), + route: NewRouter().UseEncodedPath().UnescapeVars().NewRoute().Path("/v1/{v1}/v2"), request: newRequest("GET", "http://localhost/v1/1%2F2/v2"), vars: map[string]string{"v1": "1/2"}, host: "",