Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

fix($httpBackend): remove Content-Type header on DELETE requests #3897

Closed
wants to merge 1 commit into from

Conversation

muratcorlu
Copy link

Sending empty string with XMLHttpRequest's post method causes browsers adding unneeded Content-Type request header on DELETE requests. Chrome adds Content-Type:application/xml, Firefox and IE adds Content-Type text/plain. Sending null insted of empty string fixes the problem.

More detail: #2149 (comment)

@mary-poppins
Copy link

Thanks for the PR!

  • Contributor signed CLA now or in the past
    • If you just signed, leave a comment here with your real name
  • PR's commit messages follow the commit message format

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@muratcorlu
Copy link
Author

I signed CLA about 30 minutes ago. My real name is Murat Çorlu.

@jroper
Copy link
Contributor

jroper commented Sep 23, 2013

This is duplicated by my PR: #4021

My PR includes a unit test.

@btford
Copy link
Contributor

btford commented Oct 1, 2013

Closing in favor of #4021

@btford btford closed this Oct 1, 2013
@kevin-king
Copy link

I ran into a similar problem and had to set the message body to null, not the Content-Type header to null.

$http({
method: 'DELETE',
data: null,
url: ...
})

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants