3636 * @param {Object.<Object>= } actions Hash with declaration of custom action that should extend the
3737 * default set of resource actions. The declaration should be created in the following format:
3838 *
39- * {action1: {method:?, params:?, isArray:?},
40- * action2: {method:?, params:?, isArray:?},
39+ * {action1: {method:?, params:?, isArray:?, headers:? },
40+ * action2: {method:?, params:?, isArray:?, headers:? },
4141 * ...}
4242 *
4343 * Where:
4949 * - `params` – {object=} – Optional set of pre-bound parameters for this action.
5050 * - isArray – {boolean=} – If true then the returned object for this action is an array, see
5151 * `returns` section.
52+ * - `headers` – {object=} – Optional HTTP headers to send
5253 *
5354 * @returns {Object } A resource "class" object with methods for the default set of resource actions
5455 * optionally extended with custom `actions`. The default set contains these actions:
130131 * The object returned from this function execution is a resource "class" which has "static" method
131132 * for each action in the definition.
132133 *
133- * Calling these methods invoke `$http` on the `url` template with the given `method` and `params `.
134+ * Calling these methods invoke `$http` on the `url` template with the given `method`, `params` and `headers `.
134135 * When the data is returned from the server then the object is an instance of the resource type and
135136 * all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD
136137 * operations (create, read, update, delete) on server-side data.
@@ -362,7 +363,8 @@ angular.module('ngResource', ['ng']).
362363 $http ( {
363364 method : action . method ,
364365 url : route . url ( extend ( { } , extractParams ( data ) , action . params || { } , params ) ) ,
365- data : data
366+ data : data ,
367+ headers : extend ( { } , action . headers || { } )
366368 } ) . then ( function ( response ) {
367369 var data = response . data ;
368370
@@ -417,4 +419,4 @@ angular.module('ngResource', ['ng']).
417419 }
418420
419421 return ResourceFactory ;
420- } ] ) ;
422+ } ] ) ;
0 commit comments