MCPcopy Index your code
hub / github.com/angular-ui/ui-router / parseHeaders

Function parseHeaders

test/angular/1.6/angular.js:11476–11497  ·  view source on GitHub ↗

* Parse headers into key value object * * @param {string} headers Raw headers as a string * @returns {Object} Parsed headers as key value object

(headers)

Source from the content-addressed store, hash-verified

11474 * @returns {Object} Parsed headers as key value object
11475 */
11476function parseHeaders(headers) {
11477 var parsed = createMap(), i;
11478
11479 function fillInParsed(key, val) {
11480 if (key) {
11481 parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
11482 }
11483 }
11484
11485 if (isString(headers)) {
11486 forEach(headers.split('\n'), function(line) {
11487 i = line.indexOf(':');
11488 fillInParsed(lowercase(trim(line.substr(0, i))), trim(line.substr(i + 1)));
11489 });
11490 } else if (isObject(headers)) {
11491 forEach(headers, function(headerVal, headerKey) {
11492 fillInParsed(lowercase(headerKey), trim(headerVal));
11493 });
11494 }
11495
11496 return parsed;
11497}
11498
11499
11500/**

Callers 2

headersGetterFunction · 0.70
doneFunction · 0.70

Calls 7

createMapFunction · 0.70
isStringFunction · 0.70
forEachFunction · 0.70
fillInParsedFunction · 0.70
lowercaseFunction · 0.70
trimFunction · 0.70
isObjectFunction · 0.70

Tested by

no test coverage detected