fix($http) - add ability to remove default headers

Fixes #5784
Closes #5785
This commit is contained in:
perek
2014-01-13 22:34:22 -08:00
committed by Igor Minar
parent 81cd836137
commit 34dcc0f109
2 changed files with 14 additions and 4 deletions

View File

@@ -652,6 +652,18 @@ describe('$http', function() {
$httpBackend.flush();
});
it('should delete default headers if custom header function returns null', function () {
$httpBackend.expect('POST', '/url', 'messageBody', function(headers) {
return !('Accept' in headers);
}).respond('');
$http({url: '/url', method: 'POST', data: 'messageBody', headers: {
'Accept': function() { return null; }
}});
$httpBackend.flush();
});
it('should override default headers with custom in a case insensitive manner', function() {
$httpBackend.expect('POST', '/url', 'messageBody', function(headers) {
return headers['accept'] == 'Rewritten' &&