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

Support query params in rewrites #372

Closed
ashleahhill opened this issue Sep 28, 2016 · 0 comments · Fixed by #373
Closed

Support query params in rewrites #372

ashleahhill opened this issue Sep 28, 2016 · 0 comments · Fixed by #373

Comments

@ashleahhill
Copy link
Contributor

I'm working on a project with composite ids for data entries. In order to query a particular record using JSON Server, I need to write a rewrite like this:

const rewrites = {
  '/records/:idpartone-:idparttwo/': '/records/?id.partone=:idpartone&id.parttwo=:idparttwo'
};

The rewriter correctly rewrites the url, however the new query params are not parsed. The end result is that a request to /records/:idpartone-:idparttwo/ will return the full set of /records/.

ashleahhill pushed a commit to Q-Free-OpenRoads/json-server that referenced this issue Sep 28, 2016
Re-parse the rewrite target to add query params, fixes typicode#372
typicode pushed a commit that referenced this issue Oct 1, 2016
* Add support for query params in rewrite targets

Re-parse the rewrite target to add query params, fixes #372

* Use lodash for Object.assign for node v0.12 compatibility
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

Successfully merging a pull request may close this issue.

1 participant