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

rewrite url when no params fails to pass query strings #431

Closed
Nilegfx opened this issue Dec 7, 2016 · 0 comments · Fixed by #432
Closed

rewrite url when no params fails to pass query strings #431

Nilegfx opened this issue Dec 7, 2016 · 0 comments · Fixed by #432

Comments

@Nilegfx
Copy link
Contributor

Nilegfx commented Dec 7, 2016

works

var rewrites = {'/postsWithAuthor/:id': '/posts/:id?_embed=authors'}
app.use(jsonServer.rewriter(rewrites))

not working because it doesn't update req.query object, it only update the url

var rewrites = {'/postsWithAuthor/': '/posts?_embed=authors'}
app.use(jsonServer.rewriter(rewrites))

I'll do a quick PR for to fix this.

Nilegfx pushed a commit to Nilegfx/json-server that referenced this issue Dec 7, 2016
typicode pushed a commit that referenced this issue Dec 8, 2016
* update req.query when rewrite without params #431

* add tests for rewrite rules with query and without paramas for PR #432

* [typo] add tests for rewrite rules with query and without paramas for PR #432
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