mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-26 22:35:15 +08:00
fix($http): don't remove content-type header if data is set by request transform
Fixes #7910
This commit is contained in:
committed by
rodyhaddad
parent
2e6144670d
commit
c7c363cf8d
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user