Skip to content
New issue

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

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

Already on GitHub? # to your account

ResolvePartially = true combined with multiple querystring parameters leaves a trailing curly brace. #21

Open
quasivivo opened this issue Jul 31, 2015 · 3 comments
Labels
bug help wanted This issue is available to submit a pull request for

Comments

@quasivivo
Copy link

Given a template such as: "http://test.example.org/customers{?active,country}" and setting resolvePartially to true:

When I add the active and country parameters, I would expect the output to be similar to: "http://test.example.org/customers?active=true&country=en-us"

Instead I am seeing a URL with a trailing curly brace:
"http://test.example.org/customers?active=true&country=en-us}"

@darrelmiller
Copy link
Member

This is definitely a bug. I've added a bunch more tests and there are all kinds of issues with partial resolution of query string parameters. Not sure if I'm going to be able to resolve the issues without creating a DOM for the template. Doing a single pass of the template string doesn't provide a whole lot of flexibility when it comes to partial resolution.

@chrissimon-au
Copy link

This is probably already a known case, but to confirm, if you only provide a subset of the parameters, the unreplaced parameters remain, e.g. in the example above, if only active=true was provided, you end up with:

http://test.example.org/customers?active=truecountry}

I believe it should probably become:

http://test.example.org/customers?active=true{&country}

Does that sound right?

I was going to say I'd be happy to take a look at submitting a PR for this issue - but it sounds like from the comment above that you feel that resolving this properly would require a significant refactor - is that still the case? Would you be happy for me to take a look at resolving just this case?

@darrelmiller
Copy link
Member

@chrissimon-au Thanks for reminding me about this. The problem is that the algorithm to resolve URI templates is a simple one that is designed for speed, using a single pass. It was never intended to do partial resolution. I tried to retro-fit partial resolution and did a crappy job of it. If you have any ideas I'm open to suggestions.

@baywet baywet added bug help wanted This issue is available to submit a pull request for labels Jun 28, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug help wanted This issue is available to submit a pull request for
Projects
None yet
Development

No branches or pull requests

4 participants