From 8991680d8ab632dda60cd70c780868c803c74509 Mon Sep 17 00:00:00 2001 From: Sudhir Jonathan Date: Tue, 27 Nov 2012 11:54:35 +0530 Subject: [PATCH] fix($resource): HTTP method should be case-insensitive Perform call `angular.uppercase` on all given action methods. Closes #1403 --- src/ngResource/resource.js | 1 + test/ngResource/resourceSpec.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ngResource/resource.js b/src/ngResource/resource.js index 878a6b6e2b0a..4c2a8dc1a6fa 100644 --- a/src/ngResource/resource.js +++ b/src/ngResource/resource.js @@ -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 = {}; diff --git a/test/ngResource/resourceSpec.js b/test/ngResource/resourceSpec.js index 3d2636888d7a..b9041426521e 100644 --- a/test/ngResource/resourceSpec.js +++ b/test/ngResource/resourceSpec.js @@ -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: {