Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 5723850

Browse files
committed
Added hasBody to ngResource action configuration
1 parent e7662eb commit 5723850

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ngResource/resource.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ function shallowClearAndCopy(src, dst) {
161161
* - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods -
162162
* `response` and `responseError`. Both `response` and `responseError` interceptors get called
163163
* with `http response` object. See {@link ng.$http $http interceptors}.
164+
* - **`hasBody`** - `{boolean}` - allows to specify if a request body is to be used (not
165+
* required for POST,PUT,PATCH and can't disable body inclusion on this methods).
164166
*
165167
* @param {Object} options Hash with custom settings that should extend the
166168
* default `$resourceProvider` behavior. The only supported option is
@@ -511,7 +513,7 @@ angular.module('ngResource', ['ng']).
511513
};
512514

513515
forEach(actions, function(action, name) {
514-
var hasBody = /^(POST|PUT|PATCH)$/i.test(action.method);
516+
var hasBody = /^(POST|PUT|PATCH)$/i.test(action.method) || action.hasBody === true;
515517

516518
Resource[name] = function(a1, a2, a3, a4) {
517519
var params = {}, data, success, error;

0 commit comments

Comments
 (0)