@@ -57,9 +57,9 @@ import pathToRegexp "github.com/soongo/path-to-regexp"
5757 - ** Validate** When ` false ` the function can produce an invalid (unmatched) path. (default: ` true ` )
5858 - ** Delimiter** The default delimiter for segments, e.g. ` [^/#?] ` for ` :named ` patterns. (default: ` '/#?' ` )
5959 - ** EndsWith** Optional character, or list of characters, to treat as "end" characters.
60- - ** prefixes ** List of characters to automatically consider prefixes when parsing. (default: ` ./ ` )
60+ - ** Prefixes ** List of characters to automatically consider prefixes when parsing. (default: ` ./ ` )
6161 - ** Encode** How to encode uri. (default: ` func (uri string, token interface{}) string { return uri } ` )
62- - ** Decode** How to decode uri. (default: ` func (uri string, token interface{}) string { return uri } ` )
62+ - ** Decode** How to decode uri. (default: ` func (uri string, token interface{}) ( string, error) { return uri } ` )
6363
6464``` go
6565var tokens []pathToRegexp.Token
@@ -270,7 +270,7 @@ fmt.Printf("%d %q\n", match.Index, match)
270270The ` match ` function will return a function for transforming paths into parameters:
271271
272272``` go
273- match := pathToRegexp.MustMatch (" /user/:id" , &pathToRegexp.Options {Decode: func (str string , token interface {}) string {
273+ match := pathToRegexp.MustMatch (" /user/:id" , &pathToRegexp.Options {Decode: func (str string , token interface {}) ( string , error ) {
274274 return pathToRegexp.DecodeURIComponent (str)
275275}})
276276
@@ -288,7 +288,7 @@ match("/user/caf%C3%A9")
288288The ` Parse ` function will return a list of strings and tokens from a path string:
289289
290290``` go
291- tokens := pathToRegexp.Parse (" /route/:foo/(.*)" , nil )
291+ tokens , _ := pathToRegexp.Parse (" /route/:foo/(.*)" , nil )
292292
293293fmt.Printf (" %#v \n " , tokens[0 ])
294294// => "/route"
0 commit comments