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

Function parseHeaders

tools/sendNotify.js:1433–1455  ·  view source on GitHub ↗
(headers)

Source from the content-addressed store, hash-verified

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

Callers 1

webhookNotifyFunction · 0.70

Calls 1

forEachMethod · 0.80

Tested by

no test coverage detected