-
Notifications
You must be signed in to change notification settings - Fork 343
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
Encode request data as JSON when Content-Type is set to application/json #118
Comments
you can just do this: reqwest({
url: '/api/v1/user',
method: 'post',
data: {
first_name: 'Json',
last_name: 'Doe'
}
}) |
but to answer your question, should it be converted? i don't know. is there an authoritative source saying that it should be converted? is that the standard practice? |
@ded It's a common practice to detect the |
@ded, what you posted does not work for me. Rather, a content type of I also am unable to just pass a POJO and have it converted to JSON. |
+1 very really annoying. it would be nice to support same behaviour as jquery |
Same here +1 |
+1 |
I'd recommend using the new Fetch API, it does the same as request but it has a nice Promise based API. It's not in browsers yet but there are polyfills available. |
@jonkoops fully agree |
+1 Just started using reqwest and encountered this. Definitely would be a great addition. |
+1 |
1 similar comment
+1 |
Opened a pull request #238 |
When the the
Content-Type
header of a request is set toapplication/json
shouldn't the request data be converted to a JSON string usingJSON.stringify
?Currently I'm sending my requests like this:
But it would be easier if I could do this:
The text was updated successfully, but these errors were encountered: