question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

axios.delete vs axios({method: 'delete' in Internet Explorer

See original GitHub issue

Hi, i have this piece of pseudo-code

axios.delete(`${url}`, {withCredentials: true, headers: {'uid': uid}})

and in IE10 doesn’t run but if i use

axios({
    method: 'delete',
    url: `${url}`,
    data: null,
    withCredentials: true,
    headers: {'uid': uid},
    params: {
    }

All is done. In first case i have a body request “undefined” and server reject my call with “415 http code” response and “Body must have Content-Type application/json”: in first case infact it seems to have Content-Type: text/plain; charset=UTF-8, in second i force data to null and parameter to {} all work fine

What is wrong in first piece? Thanks in advance.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
artishipcommented, Dec 27, 2017

This is not work

axios(url, {headers: {'Content-Type': 'application/json'}})

add data property as null then it works

axios({
method: 'delete'
url: `${url}`,
data: null,
headers: {'Content-Type': 'application/json'}
})
0reactions
uxlayoutscommented, Aug 8, 2017

Yeah an example in the docs would be nice. Using all @nickuraltsev example, but json-server deletes all records.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Axios React – How to Make Get, Post, and Delete API Requests
As the name implies, you use this to delete specific data from your endpoint/API as well as your UI – DELETE can handle...
Read more >
Axios DELETE Requests - Mastering JS
Axios has a axios.delete() function that makes it easy to send an HTTP DELETE request to a given URL.
Read more >
GET, POST , PUT , DELETE in Axios - DEV Community ‍ ‍
Axios is a promise-based HTTP Client for node.js and the browser. ... try { await axios({ url: url, method: "DELETE", data: data, }) ......
Read more >
Why can't I make this axios DELETE request? [duplicate]
Look into CORS for details, but it basilcy means the request source (i.e. localhost) isn't allowed to make a request to the request...
Read more >
React Axios Send Asynchronous HTTP Delete Request Tutorial
HTTP Delete request an ideally used to remove or delete a resource or data object from the server. To create a consensus with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found