I have to send a get request to get a value from server and display it in my react application. But for some reason it is throwing 400 error code. I think there might be an issue with my get request. So I read many articles but they all said that you can send it using params property of config object of axios.get but I have to send it as body of request.
Asked
Active
Viewed 570 times
1 Answers
0
GET requests shouldn't have any request body. Your request is giving 400 because the server can't compile your GET request with a request body. If you want to retrieve data from the backend, you can send params in the URL or request header.
For more info, you can visit this same question asked https://stackoverflow.com/questions/978061/http-get-with-request-body[][1]

SaqibSyed1014
- 1
- 2
-
I understand that. But then why it's working if I use Postman to send. When using postman status code is 200 and response has the data I need – Abhishek Kumar Mishra Oct 26 '22 at 04:20