mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
feat($http): add a default content type for PATH requests
The default header is now application/json which while not perfect in all cases is better than the browser default application/xml. The new headers also makes for better compatibility with Rails 4
This commit is contained in:
committed by
Igor Minar
parent
1f99c3a521
commit
f9b897de4b
@@ -684,6 +684,15 @@ describe('$http', function() {
|
||||
$httpBackend.flush();
|
||||
});
|
||||
|
||||
it('should set default headers for PATCH request', function() {
|
||||
$httpBackend.expect('PATCH', '/url', 'messageBody', function(headers) {
|
||||
return headers['Accept'] == 'application/json, text/plain, */*' &&
|
||||
headers['Content-Type'] == 'application/json;charset=utf-8';
|
||||
}).respond('');
|
||||
|
||||
$http({url: '/url', method: 'PATCH', headers: {}, data: 'messageBody'});
|
||||
$httpBackend.flush();
|
||||
});
|
||||
|
||||
it('should set default headers for custom HTTP method', function() {
|
||||
$httpBackend.expect('FOO', '/url', undefined, function(headers) {
|
||||
|
||||
Reference in New Issue
Block a user