Add support for queries in URL reversing.

This commit is contained in:
Pavel Ivanov
2017-02-19 19:05:42 +03:00
committed by Kamil Kisiel
parent 043ee6597c
commit 9c9af153a1
2 changed files with 15 additions and 3 deletions

View File

@@ -178,6 +178,9 @@ func (r *routeRegexp) url(values map[string]string) (string, error) {
if !ok {
return "", fmt.Errorf("mux: missing route variable %q", v)
}
if r.matchQuery {
value = url.QueryEscape(value)
}
urlValues[k] = value
}
rv := fmt.Sprintf(r.reverse, urlValues...)