Skip to content

Commit

Permalink
feat($resource): allow defining headers per action
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmart committed Jun 5, 2012
1 parent c159b3d commit 5bec221
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ngResource/resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,4 +419,4 @@ angular.module('ngResource', ['ng']).
}

return ResourceFactory;
}]);
}]);
7 changes: 5 additions & 2 deletions test/ngResource/resourceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ describe("resource", function() {
R.get({a:4, b:5, c:6});
});


it('should support escaping colons in url template', function() {
var R = $resource('http://localhost\\:8080/Path/:a/\\:stillPath/:b');

Expand Down Expand Up @@ -151,14 +152,16 @@ describe("resource", function() {
expect(callback.mostRecentCall.args[1]()).toEqual({});
});


it('should send correct headers', function() {
$httpBackend.expectPUT('/CreditCard/123', undefined, function(headers) {
return headers['If-None-Match'] == "*";
}).respond({id:123});

CreditCard.conditionalPut({id: {key:123}});
});



it("should read partial resource", function() {
$httpBackend.expect('GET', '/CreditCard').respond([{id:{key:123}}]);
var ccs = CreditCard.query();
Expand Down Expand Up @@ -353,4 +356,4 @@ describe("resource", function() {
expect(callback).not.toHaveBeenCalled();
});
});
});
});

1 comment on commit 5bec221

@maxmart
Copy link
Owner Author

@maxmart maxmart commented on 5bec221 Jun 5, 2012

Choose a reason for hiding this comment

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

Like this? :-)

Please sign in to comment.