Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fromUri() incorrectly picks up trailing chars #25

Open
jwalton opened this issue Apr 11, 2018 · 1 comment
Open

fromUri() incorrectly picks up trailing chars #25

jwalton opened this issue Apr 11, 2018 · 1 comment

Comments

@jwalton
Copy link

jwalton commented Apr 11, 2018

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?

@jwalton
Copy link
Author

jwalton commented Apr 12, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant