MCPcopy Create free account
hub / github.com/Yaffle/EventSource / HeadersPolyfill

Function HeadersPolyfill

tests/eventsource.js:456–468  ·  view source on GitHub ↗
(all)

Source from the content-addressed store, hash-verified

454 }
455
456 function HeadersPolyfill(all) {
457 // Get headers: implemented according to mozilla's example code: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/getAllResponseHeaders#Example
458 var map = Object.create(null);
459 var array = all.split("\r\n");
460 for (var i = 0; i < array.length; i += 1) {
461 var line = array[i];
462 var parts = line.split(": ");
463 var name = parts.shift();
464 var value = parts.join(": ");
465 map[toLowerCase(name)] = value;
466 }
467 this._map = map;
468 }
469 HeadersPolyfill.prototype.get = function (name) {
470 return this._map[toLowerCase(name)];
471 };

Callers

nothing calls this directly

Calls 1

toLowerCaseFunction · 0.70

Tested by

no test coverage detected