Use axios to send data, but the backend cannot receive it. How to do it?

clipboard.png

clipboard.png

I always want to talk about json data, but it is json that axios passes by default. It"s no good to use qs. Does anyone know what to do?

May.23,2022

based on several interactions with the front and back end and problems encountered by others, it is concluded that the json referred to by the back-end developer refers to the json string, while the json mentioned by the front-end developer, usually Object, provides a request header and a screenshot of the request body related to the network request of browser F12 if the request is correct


< del >. < / del >
(sorry I didn't see the picture in time due to network reasons)
that's the problem in the background. in addition, if you don't tell the background what it was written, no one else can help.
different languages have different ways of receiving and processing json.


what is the http error code


this problem allows the backend to view the log. The front end can see the request from the screenshot.


API is annotated without @ RequestParam


this kind of error, first use the postman request to determine whether it is a background problem, or find the background. Instead of taking a closer look at your own code


axios, the default type is json


should be a problem with the processing mechanism. I also encountered this problem some time ago when I was developing a project. The interface of Java can not receive the json transmitted by axios, while the interface of go can be changed to ajax. Both Java and go can be replaced. This is the back-end problem.


is the interface annotated?


try converting him into a string


axios parameter

Menu