From 0c3500f532c1c2d7fb455206822c8a42561c962c 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 4f468d426b42..e357824980cb 100644 --- a/src/ngResource/resource.js +++ b/src/ngResource/resource.js @@ -325,6 +325,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 dfe98ed2c1da..8ff248b76949 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: {