Skip to content

Commit

Permalink
fix($resource): HTTP method should be case-insensitive
Browse files Browse the repository at this point in the history
Perform call `angular.uppercase` on all given action methods.

Closes angular#1403
  • Loading branch information
sudhirj authored and jbdeboer committed Jan 18, 2013
1 parent e273b3c commit 9b31f0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/ngResource/resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ angular.module('ngResource', ['ng']).
}

forEach(actions, function(action, name) {
action.method = angular.uppercase(action.method);
var hasBody = action.method == 'POST' || action.method == 'PUT' || action.method == 'PATCH';
Resource[name] = function(a1, a2, a3, a4) {
var params = {};
Expand Down
2 changes: 1 addition & 1 deletion test/ngResource/resourceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe("resource", function() {
$resource = $injector.get('$resource');
CreditCard = $resource('/CreditCard/:id:verb', {id:'@id.key'}, {
charge:{
method:'POST',
method:'post',
params:{verb:'!charge'}
},
patch: {
Expand Down

0 comments on commit 9b31f0f

Please sign in to comment.