diff options
| -rw-r--r-- | src/ng/http.js | 8 | ||||
| -rw-r--r-- | test/ng/httpSpec.js | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/ng/http.js b/src/ng/http.js index 231e683e..4ca89e4f 100644 --- a/src/ng/http.js +++ b/src/ng/http.js @@ -111,9 +111,9 @@ function $HttpProvider() { common: { 'Accept': 'application/json, text/plain, */*' }, - post: CONTENT_TYPE_APPLICATION_JSON, - put: CONTENT_TYPE_APPLICATION_JSON, - patch: CONTENT_TYPE_APPLICATION_JSON + post: copy(CONTENT_TYPE_APPLICATION_JSON), + put: copy(CONTENT_TYPE_APPLICATION_JSON), + patch: copy(CONTENT_TYPE_APPLICATION_JSON) }, xsrfCookieName: 'XSRF-TOKEN', @@ -324,7 +324,7 @@ function $HttpProvider() { * to `push` or `unshift` a new transformation function into the transformation chain. You can * also decide to completely override any default transformations by assigning your * transformation functions to these properties directly without the array wrapper. These defaults - * are again available on the $http factory at run-time, which may be useful if you have run-time + * are again available on the $http factory at run-time, which may be useful if you have run-time * services you wish to be involved in your transformations. * * Similarly, to locally override the request/response transforms, augment the diff --git a/test/ng/httpSpec.js b/test/ng/httpSpec.js index d3653a67..a0417d9a 100644 --- a/test/ng/httpSpec.js +++ b/test/ng/httpSpec.js @@ -1439,6 +1439,12 @@ describe('$http', function() { $http.get('/url'); $httpBackend.flush(); }); + + it('should have seperate opbjects for defaults PUT and POST', function() { + expect($http.defaults.headers.post).not.toBe($http.defaults.headers.put); + expect($http.defaults.headers.post).not.toBe($http.defaults.headers.patch); + expect($http.defaults.headers.put).not.toBe($http.defaults.headers.patch); + }) }); }); |
