MCPcopy Index your code
hub / github.com/WP-API/node-wpapi / _setHeaders

Function _setHeaders

lib/http-transport.js:23–34  ·  view source on GitHub ↗

* Set any provided headers on the outgoing request object. Runs after _auth. * * @method _setHeaders * @private * @param {Object} request A superagent request object * @param {Object} options A WPRequest _options object * @param {Object} A superagent request object, with any available headers

( request, options )

Source from the content-addressed store, hash-verified

21 * @param {Object} A superagent request object, with any available headers set
22 */
23function _setHeaders( request, options ) {
24 // If there's no headers, do nothing
25 if ( ! options.headers ) {
26 return request;
27 }
28
29 return objectReduce(
30 options.headers,
31 ( request, value, key ) => request.set( key, value ),
32 request
33 );
34}
35
36/**
37 * Conditionally set basic authentication on a server request object.

Callers 5

_httpGetFunction · 0.85
_httpPostFunction · 0.85
_httpPutFunction · 0.85
_httpDeleteFunction · 0.85
_httpHeadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected