Axios Delete request with body and headers?

后端 未结 11 2142
梦谈多话
梦谈多话 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:06

    axiox.delete does support a request body. It accepts two parameters: url and optional config. You can use config.data to set the request body and headers as follows:

    axios.delete(url, { data: { foo: "bar" }, headers: { "Authorization": "***" } });
    

    See Here - https://github.com/axios/axios/issues/897

提交回复
热议问题