Skip to content

Commit

Permalink
fix headers common, tests pass: closes angular#5742
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendrixer committed Jan 11, 2014
1 parent c7a46d4 commit 189673f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ng/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions test/ng/httpSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1430,6 +1430,12 @@ describe('$http', function() {

it('should expose the defaults object at runtime', function() {
expect($http.defaults).toBeDefined();
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);
expect($http.defaults.headers.put).not.toBe($http.defaults.headers.post);
expect($http.defaults.headers.patch).not.toBe($http.defaults.headers.put);
expect($http.defaults.headers.patch).not.toBe($http.defaults.headers.post);

$http.defaults.headers.common.foo = 'bar';
$httpBackend.expect('GET', '/url', undefined, function(headers) {
Expand Down

4 comments on commit 189673f

@pwarelis
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last three tests are a bit redundant, yes?

@Hendrixer
Copy link
Owner Author

@Hendrixer Hendrixer commented on 189673f Jan 12, 2014 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IgorMinar
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, we don't want redundant assertions.

it would also be better to have separate it spec for this with a good description.

then the commit message doesn't have the right format.

lastly we need a PR out of this and have you sign a CLA (just a quick click-through form).

can you make the changes? so that we can get this in?

thanks a ton!

@Hendrixer
Copy link
Owner Author

@Hendrixer Hendrixer commented on 189673f Jan 12, 2014 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.