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

Commit 745d347

Browse files
committed
Added hasBody to ngResource action configuration
1 parent 752b1e6 commit 745d347

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ngResource/resource.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ function shallowClearAndCopy(src, dst) {
193193
* - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods -
194194
* `response` and `responseError`. Both `response` and `responseError` interceptors get called
195195
* with `http response` object. See {@link ng.$http $http interceptors}.
196+
* - **`hasBody`** - `{boolean}` - allows to specify if a request body is to be used (not
197+
* required for POST,PUT,PATCH and can't disable body inclusion on this methods).
196198
*
197199
* @param {Object} options Hash with custom settings that should extend the
198200
* default `$resourceProvider` behavior. The supported options are:
@@ -640,7 +642,7 @@ angular.module('ngResource', ['ng']).
640642
};
641643

642644
forEach(actions, function(action, name) {
643-
var hasBody = /^(POST|PUT|PATCH)$/i.test(action.method);
645+
var hasBody = /^(POST|PUT|PATCH)$/i.test(action.method) || action.hasBody === true;
644646
var numericTimeout = action.timeout;
645647
var cancellable = isDefined(action.cancellable) ?
646648
action.cancellable : route.defaults.cancellable;

0 commit comments

Comments
 (0)