Send post request to report 500error, how to solve it?

problem description

I am doing the favorite theme function of cnodejs, using the vue framework. Send post to request 500 errors from the Times.

related codes

/ / Please paste the code text below (do not replace the code with pictures)
< Button type= "success" class= "collect": class= "{"cancel-col": info.is_collect}" @ click= "collect (info.id)" > {{isCollect} < / Button >

/ / collect or uncollect

collect(id){
  let accesstoken = Cookies.get("accesstoken");

  if(this.info.is_collect){
    //
  }else{
    //
    axios.post("https://cnodejs.org/api/v1/topic_collect/collect", {
      accesstoken,
      id
      }).then((res) => {
      console.log(res.data);
    }, (error) => {
      console.log(error);
    });
  }
}

what result do you expect? What is the error message actually seen?

POST https://cnodejs.org/api/v1/to. 500 (Internal Server Error)


Brother what I summed up is quite applicable in most cases. Less than 500 may be our problem, but if you talk to your backstage over 500, to put it bluntly, it may be caused by the abnormal running of their code, so don't spray it. It's just your personal opinion


you can use the network of the developer's tool to see what the post request returns. The 500th visual inspection is reported only when the background code sends out the bug and returns the error page. You can communicate with the backend


as mentioned upstairs, I attach a picture. The developer mode chooses Network, to select the file in which you interact, look at the contents of Header, and pull to the end your request parameters. Check the request parameters with the background.
if there is no problem with the request parameters, it may be the BUG in the background.


this seems to be the json format post request you sent in formdata format. I recommend that you start with qs


5. All the errors are reported inside the back-end interface program.

Menu