mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-18 19:41:07 +00:00
fix($resource): HTTP method should be case-insensitive
Perform call `angular.uppercase` on all given action methods. Closes #1403
This commit is contained in:
parent
c12f525df4
commit
0c3500f532
2 changed files with 2 additions and 1 deletions
|
|
@ -325,6 +325,7 @@ angular.module('ngResource', ['ng']).
|
||||||
}
|
}
|
||||||
|
|
||||||
forEach(actions, function(action, name) {
|
forEach(actions, function(action, name) {
|
||||||
|
action.method = angular.uppercase(action.method);
|
||||||
var hasBody = action.method == 'POST' || action.method == 'PUT' || action.method == 'PATCH';
|
var hasBody = action.method == 'POST' || action.method == 'PUT' || action.method == 'PATCH';
|
||||||
Resource[name] = function(a1, a2, a3, a4) {
|
Resource[name] = function(a1, a2, a3, a4) {
|
||||||
var params = {};
|
var params = {};
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ describe("resource", function() {
|
||||||
$resource = $injector.get('$resource');
|
$resource = $injector.get('$resource');
|
||||||
CreditCard = $resource('/CreditCard/:id:verb', {id:'@id.key'}, {
|
CreditCard = $resource('/CreditCard/:id:verb', {id:'@id.key'}, {
|
||||||
charge:{
|
charge:{
|
||||||
method:'POST',
|
method:'post',
|
||||||
params:{verb:'!charge'}
|
params:{verb:'!charge'}
|
||||||
},
|
},
|
||||||
patch: {
|
patch: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue