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 nested objects in query params #39

Merged
merged 1 commit into from
Apr 24, 2018

Conversation

hwuethrich
Copy link
Contributor

While trying to expose a moleculer-db service through the API gateway I noticed there is no way to pass the query param to the services list action (doc). The service expects the query param to be of type object but nested objects are not supported by node's querystring module (see nodejs/node-v0.x-archive#1665).

This PR replaces querystring with qs, which supports nested objects.

Example Request:
GET /users/list?query[name]=Peter

Before (using querystring module):
params: { "query[name]": "Peter" }

After (using qs module):
params: { "query": { "name": "Peter" }}

What do you think?

@coveralls
Copy link

coveralls commented Apr 24, 2018

Pull Request Test Coverage Report for Build 229

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 91.304%

Totals Coverage Status
Change from base Build 225: 0.0%
Covered Lines: 412
Relevant Lines: 438

💛 - Coveralls

@icebob
Copy link
Member

icebob commented Apr 24, 2018

Good idea, and nice PR with tests! Thanks!

@icebob icebob merged commit 3299c4c into moleculerjs:master Apr 24, 2018
@icebob
Copy link
Member

icebob commented Apr 24, 2018

Released in moleculer-web@0.7.0-beta4

@hwuethrich
Copy link
Contributor Author

@icebob No problem! And thanks for the quick release! 😀

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 this pull request may close these issues.

None yet

3 participants