GET request does not send data (JSON).
See original GitHub issueCode:
axios.get("/api/v1/post/allFromUser", {data: {"author": "fharding"}}).then(response => {
this.posts = response.data;
}).catch(err => {
alert(err);
console.log(err);
})
When I switch this to POST the data get’s send just find, but there is no body when sent with GET. Sending JSON with GET is not against spec, why is this not working? I’ve also tried using json.stringify for sending the data.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:60
- Comments:55 (4 by maintainers)
Top Results From Across the Web
requests lib post request not sending proper json format data
I am calling this API using postman & it is giving me proper response but when I use Python's requests lib to call...
Read more >How do I post JSON to the server? - ReqBin
To send JSON data to the server, you need to provide the JSON data in the HTTP POST request body and pass the...
Read more >Sending POST JSON Requests With Axios - Stack Abuse
In this article, we will learn how to send POST JSON requests with Axios, and how to handle both previously serialized and unserialized...
Read more >Add a Request Body to a POST Request | API Connector
If your POST request isn't working, a likely cause is a mismatched content type. Try adding in a content type into the header...
Read more >Quickstart — Requests 2.28.1 documentation
In case the JSON decoding fails, r.json() raises an exception. For example, if the response gets a 204 (No Content), or if the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
because get requests doesn’t have a body use query params instead
I think GET is not for sending data. the only way to pass information with GET is in through request parameter.