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

Pass body of GET requests down to superagent #55

Closed
acontreras89 opened this issue Mar 30, 2017 · 2 comments
Closed

Pass body of GET requests down to superagent #55

acontreras89 opened this issue Mar 30, 2017 · 2 comments

Comments

@acontreras89
Copy link
Contributor

superagent supports data for GET requests, sending it as query parameters. I was wondering why this ability has been removed in redux-query's adapter.

Instead of manually sending the body, shouldn't the adapter let superagent handle the body itself?

This change is pretty straight forward. I'd create a PR myself but I wanted to first ask if there's any good reason to not have this already.

@ryanashcraft
Copy link
Contributor

Good question. It's mostly an effort to try to keep things simple. You can always bring your own query stringify library without much pain. A lot of our urls look like /api/example-endpoint?${qs(params)}. This is also nice because there are different ways to encode arrays and nested objects as query params. Just seems easier to support than having a bunch of different options for configuring the encoding.

@acontreras89
Copy link
Contributor Author

@ryanashcraft I've gone ahead and created #57 so you can see how simple the change is :)

Also, note that this doesn't remove the ability to manually parse and add query parameters to your URL:

import superagent from 'superagent'

const request = superagent.get('localhost?a=1', { b: 2 }) // localhost?a=1&b=2
request.query({ c: 3 }) // localhost?a=1&b=2&c=3

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

No branches or pull requests

2 participants