The vue front end reported an error when using axios to send a request: uncaught (in promise) Error: Request failed with status code 400.

The error is shown in the figure: 

Front-end code:

const pushdata=(postdata,callback)=>{
  console.log(postdata)
  axios.get(portUrl+ 'comments/putdata',postdata)
      .then(()=>{
          // location.reload()
          }
      )}

Back-end code (when you see @RequestBody, you know that the front-end sends a post in json format):

 

In fact, the reason is very simple, because it is a post request, you should change axios.get to axios.put.....

Guess you like

Origin blog.csdn.net/Zhongtongyi/article/details/111518649