Axios Delete request with body and headers?

后端 未结 11 2120
梦谈多话
梦谈多话 2020-11-28 08:16

I\'m using Axios while programing in ReactJS and I pretend to send a DELETE request to my server.

To do so I need the headers:

headers: {
  \'Authori         


        
11条回答
  •  情深已故
    2020-11-28 09:05

    I tried all of the above which did not work for me. I ended up just going with PUT (inspiration found here) and just changed my server side logic to perform a delete on this url call. (django rest framework function override).

    e.g.

    .put(`http://127.0.0.1:8006/api/updatetoken/20`, bayst)
          .then((response) => response.data)
          .catch((error) => { throw error.response.data; });
    

提交回复
热议问题