aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/httpSpec.js
diff options
context:
space:
mode:
authorDaniel Stockton2013-05-11 19:23:33 +0300
committerIgor Minar2013-05-16 14:05:05 -0700
commitf9b897de4b5cc438515cbb54519fbdf6242f5858 (patch)
tree4caccb717a93930196a9b862ee93ca84ad5d9d8c /test/ng/httpSpec.js
parent1f99c3a521e84902e3021166d8024c8f419e53d2 (diff)
downloadangular.js-f9b897de4b5cc438515cbb54519fbdf6242f5858.tar.bz2
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
Diffstat (limited to 'test/ng/httpSpec.js')
-rw-r--r--test/ng/httpSpec.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ng/httpSpec.js b/test/ng/httpSpec.js
index e6d1cf4f..5984106c 100644
--- a/test/ng/httpSpec.js
+++ b/test/ng/httpSpec.js
@@ -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) {