MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / parseHeaders

Function parseHeaders

packages/core/fetch/index.mjs:384–398  ·  view source on GitHub ↗
(rawHeaders)

Source from the content-addressed store, hash-verified

382 }
383
384 function parseHeaders(rawHeaders) {
385 var headers = new Headers();
386 // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
387 // https://tools.ietf.org/html/rfc7230#section-3.2
388 var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, " ");
389 preProcessedHeaders.split(/\r?\n/).forEach(function (line) {
390 var parts = line.split(":");
391 var key = parts.shift().trim();
392 if (key) {
393 var value = parts.join(":").trim();
394 headers.append(key, value);
395 }
396 });
397 return headers;
398 }
399
400 Body.call(Request.prototype);
401

Callers 1

fetchFunction · 0.85

Calls 5

replaceMethod · 0.80
forEachMethod · 0.80
shiftMethod · 0.80
joinMethod · 0.80
appendMethod · 0.65

Tested by

no test coverage detected