Closed gavacho closed 11 years ago
I don't mind opening a PR for this if someone can confirm it's a bug.
I see your point. But the RFC is a little inconsequent with encoding. See http://tools.ietf.org/html/rfc6570#section-2.3 "A varname MAY contain one or more pct-encoded triplets. These triplets are considered an essential part of the variable name and are not decoded during processing. A varname containing pct-encoded characters is not the same variable as a varname with those same characters decoded. Applications that provide URI Templates are expected to be consistent in their use of pct-encoding within variable names." So I think, it is not a bug, but a ... RFC
I apologize for not knowing how this behavior is defined by the RFC.
Given a template like:
{&sort%5B%5D*}
, the object which is passed to UriTemplate'sexpand
method must also have its properties percent-encoded. It seems like percent-encoding should be the concern of UriTemplate and not the caller.Here's a fiddle: http://jsfiddle.net/uqcMf/ - notice that the "filter" variable isn't expanded correctly.