MCPcopy
hub / github.com/angular-ui/ui-router / headersGetter

Function headersGetter

test/angular/1.7/angular.js:12083–12099  ·  view source on GitHub ↗

* Returns a function that provides access to parsed headers. * * Headers are lazy parsed when first requested. * @see parseHeaders * * @param {(string|Object)} headers Headers to provide access to. * @returns {function(string=)} Returns a getter function which if called with: * * - if call

(headers)

Source from the content-addressed store, hash-verified

12081 * - if called with no arguments returns an object containing all headers.
12082 */
12083function headersGetter(headers) {
12084 var headersObj;
12085
12086 return function(name) {
12087 if (!headersObj) headersObj = parseHeaders(headers);
12088
12089 if (name) {
12090 var value = headersObj[lowercase(name)];
12091 if (value === undefined) {
12092 value = null;
12093 }
12094 return value;
12095 }
12096
12097 return headersObj;
12098 };
12099}
12100
12101
12102/**

Callers 2

serverRequestFunction · 0.70
resolvePromiseFunction · 0.70

Calls 2

parseHeadersFunction · 0.70
lowercaseFunction · 0.70

Tested by

no test coverage detected