This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
$http.delete causes non-zero Content-Length header in IE10 due to passing undefined to xhr.send #12141
Closed
Description
Since 1.4.0-rc1 and confirmed in 1.4.1, calling $http.delete('url')
in IE10 causes a non-zero Content-Length header to be added to the request. I noticed this when the webserver was returning HTTP error code 415 on all $http.delete
calls.
I tracked this down to 1.4.0-rc1 where xhr.send(post || null)
in createHttpBackend was changed to xhr.send(post)
. When post is undefined, this problem occurs in IE10. The code below reproduces this bug in IE10 and is essentially what $http.delete('url')
is doing.
var xhr= new window.XMLHttpRequest();
var post;
xhr.open('DELETE', 'url', true);
xhr.send(post);
Changing xhr.send(post)
to xhr.send(post || null)
fixes the problem.