fix($http): don't remove content-type header if data is set by request transform

Fixes #7910
This commit is contained in:
Martin Staffa
2014-06-25 20:34:55 +02:00
committed by rodyhaddad
parent 2e6144670d
commit c7c363cf8d
2 changed files with 17 additions and 1 deletions

View File

@@ -693,6 +693,22 @@ describe('$http', function() {
$httpBackend.flush();
});
it('should NOT delete Content-Type header if request data/body is set by request transform', function() {
$httpBackend.expect('POST', '/url', {'one' : 'two'}, function(headers) {
return headers['Content-Type'] == 'application/json;charset=utf-8';
}).respond('');
$http({
url: '/url',
method: 'POST',
transformRequest : function(data) {
data = {'one' : 'two'};
return data;
}
});
$httpBackend.flush();
});
it('should set the XSRF cookie into a XSRF header', inject(function($browser) {
function checkXSRF(secret, header) {