You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Disable certain $http headers for an individual request #1587
I'm using $http with FormData to send multiple files, and I need to not set Content-Type, or the browser will not set Content-Type and the multipart boundary won't be known.
I can do this by saving, deleting, and restoring the header in $http.defaults.headers, but It would be a lot nicer to do $http.post(url, data, {headers: {'Content-Type': null}}).
The request should include the header Content-Type: multipart/form-data; boundary=blahblahblah. I thought it sent Content-Type: application/xml when I tried this last, but I must have been doing something else different.
Activity
pkozlowski-opensource commentedon Nov 17, 2012
@groner Kei, unless I'm missing something (which is probably the case!) it is already possible, check this jsFiddle: http://jsfiddle.net/4sCPp/4/
Could you try to provide a bit more info about what is going on on your side?
groner commentedon Nov 17, 2012
This seems to be working fine now. I'm not sure what I did differently yesterday, but it's not happening now.
Here's what I'm doing if you're curious:
The request should include the header
Content-Type: multipart/form-data; boundary=blahblahblah. I thought it sentContent-Type: application/xmlwhen I tried this last, but I must have been doing something else different.