MCPcopy
hub / github.com/lissy93/web-check / headersToObject

Function headersToObject

api/_common/http.js:19–30  ·  view source on GitHub ↗
(headers)

Source from the content-addressed store, hash-verified

17};
18
19const headersToObject = (headers) => {
20 const out = {};
21 for (const [k, v] of headers.entries()) {
22 const key = k.toLowerCase();
23 if (key === 'set-cookie') {
24 out[key] = headers.getSetCookie ? headers.getSetCookie() : v.split(/, (?=[^;]+=)/);
25 } else {
26 out[key] = v;
27 }
28 }
29 return out;
30};
31
32// Auto-parse JSON when the response advertises it, fall back to raw text
33const parseBody = async (response) => {

Callers 1

sendFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected