MCPcopy Index your code
hub / github.com/smallfawn/QLScriptPublic / parseHeaders

Function parseHeaders

sendNofity.js:1437–1459  ·  view source on GitHub ↗
(headers)

Source from the content-addressed store, hash-verified

1435}
1436
1437function parseHeaders(headers) {
1438 if (!headers) return {};
1439
1440 const parsed = {};
1441 let key;
1442 let val;
1443 let i;
1444
1445 headers &&
1446 headers.split('\n').forEach(function parser(line) {
1447 i = line.indexOf(':');
1448 key = line.substring(0, i).trim().toLowerCase();
1449 val = line.substring(i + 1).trim();
1450
1451 if (!key) {
1452 return;
1453 }
1454
1455 parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1456 });
1457
1458 return parsed;
1459}
1460
1461function parseBody(body, contentType, valueFormatFn) {
1462 if (contentType === 'text/plain' || !body) {

Callers 1

webhookNotifyFunction · 0.70

Calls 1

forEachMethod · 0.80

Tested by

no test coverage detected