diff options
| author | simpulton | 2012-04-20 01:31:25 -0700 | 
|---|---|---|
| committer | Igor Minar | 2012-04-20 12:32:33 -0700 | 
| commit | e61fd1b43a55496c11c63da7ca2fc05b88d44043 (patch) | |
| tree | 007761363c98350ea42cda871b73dfb62d49b1a0 /src/ngResource | |
| parent | ce15a3e0491f7acafcdf0ff07f75d0c2c9819164 (diff) | |
| download | angular.js-e61fd1b43a55496c11c63da7ca2fc05b88d44043.tar.bz2 | |
feat($resource): support HTTP PATCH method
Properly serialize data into request body instead of url.
Closes #887
Diffstat (limited to 'src/ngResource')
| -rw-r--r-- | src/ngResource/resource.js | 6 | 
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ngResource/resource.js b/src/ngResource/resource.js index db198401..d19a1d6a 100644 --- a/src/ngResource/resource.js +++ b/src/ngResource/resource.js @@ -318,7 +318,7 @@ angular.module('ngResource', ['ng']).        }        forEach(actions, function(action, name) { -        var isPostOrPut = action.method == 'POST' || action.method == 'PUT'; +        var hasBody = action.method == 'POST' || action.method == 'PUT' || action.method == 'PATCH';          Resource[name] = function(a1, a2, a3, a4) {            var params = {};            var data; @@ -349,7 +349,7 @@ angular.module('ngResource', ['ng']).              }            case 1:              if (isFunction(a1)) success = a1; -            else if (isPostOrPut) data = a1; +            else if (hasBody) data = a1;              else params = a1;              break;            case 0: break; @@ -409,7 +409,7 @@ angular.module('ngResource', ['ng']).              throw "Expected between 1-3 arguments [params, success, error], got " +                arguments.length + " arguments.";            } -          var data = isPostOrPut ? this : undefined; +          var data = hasBody ? this : undefined;            Resource[name].call(this, params, data, success, error);          };        });  | 
