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

Function parseHeaders

test/angular/1.5/angular.js:10897–10918  ·  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

10895 * @returns {Object} Parsed headers as key value object
10896 */
10897function parseHeaders(headers) {
10898 var parsed = createMap(), i;
10899
10900 function fillInParsed(key, val) {
10901 if (key) {
10902 parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
10903 }
10904 }
10905
10906 if (isString(headers)) {
10907 forEach(headers.split('\n'), function(line) {
10908 i = line.indexOf(':');
10909 fillInParsed(lowercase(trim(line.substr(0, i))), trim(line.substr(i + 1)));
10910 });
10911 } else if (isObject(headers)) {
10912 forEach(headers, function(headerVal, headerKey) {
10913 fillInParsed(lowercase(headerKey), trim(headerVal));
10914 });
10915 }
10916
10917 return parsed;
10918}
10919
10920
10921/**

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