Axios DELETE Requests

Sep 11, 2020

Axios has a axios.delete() function that makes it easy to send an HTTP DELETE request to a given URL.

const res = await axios.delete('https://httpbin.org/delete');

res.status; // 200

Unlike axios.post() and axios.put(), the 2nd param to axios.delete() is the axios.post(), not the request body. To send a request body with a DELETE request, you should use the data option.

const res = await axios.delete('https://httpbin.org/delete', { data: { answer: 42 } });

res.data.json; // { answer: 42 }

More Axios Tutorials