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('');

res.status; // 200

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

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

Did you find this tutorial useful? Say thanks by starring our repo on GitHub!