From 7885b613b0ef36c8c066d2de8749397155623210 Mon Sep 17 00:00:00 2001 From: Francesco Mari Date: Fri, 17 Dec 2021 12:28:06 +0100 Subject: [PATCH] Add an example in the godoc --- mux.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mux.go b/mux.go index bf353ae..e7abb47 100644 --- a/mux.go +++ b/mux.go @@ -265,6 +265,12 @@ func (r *Router) SkipClean(value bool) *Router { // UnescapeVars tells the router to escape the route variables before invoking // the handler. This is useful when used together with UseEncodedPath to avoid // un-escaping the variable values in the handler. +// +// 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 return r