feat($resource): support custom headers per action

Closes #736
This commit is contained in:
Max Martinsson
2012-05-17 17:11:25 +02:00
committed by Misko Hevery
parent 0d52ff0f10
commit b936e52874
2 changed files with 22 additions and 4 deletions

View File

@@ -14,7 +14,14 @@ describe("resource", function() {
},
patch: {
method: 'PATCH'
},
conditionalPut: {
method: 'PUT',
headers: {
'If-None-Match': '*'
}
}
});
callback = jasmine.createSpy();
}));
@@ -146,6 +153,15 @@ describe("resource", function() {
});
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();