uri-templates
uri-templates copied to clipboard
`fromUri()` incorrectly picks up trailing chars
const template = uriTemplate("/foo/{bar}");
const params = template.fromUri('/foo/bar/');
console.log(params.bar);
This prints "bar/". I would expect params
to be undefined though, because "/" isn't allowed in a simple expansion?
Oh, it's not just trialing chars:
const template = new UriTemplate('/a/{b}/c');
template.fromUri('/a/foo/bar/c'); // Returns `{b: 'foo/bar'}`
To my mind this is the main difference between the template '/a/{b}/c' and '/a/{+b}/c' - the first should not allow extra "/"s to match, where the second should.