MCPcopy
hub / github.com/smallfawn/QLScriptPublic / request

Function request

sendNofity.js:5–24  ·  view source on GitHub ↗
(url, options = {})

Source from the content-addressed store, hash-verified

3const timeout = 15000;
4
5async function request(url, options = {}) {
6 const { json, form, body, headers = {}, ...rest } = options;
7
8 const finalHeaders = { ...headers };
9 let finalBody = body;
10
11 if (json) {
12 finalHeaders['content-type'] = 'application/json';
13 finalBody = JSON.stringify(json);
14 } else if (form) {
15 finalBody = form;
16 delete finalHeaders['content-type'];
17 }
18
19 return undiciRequest(url, {
20 headers: finalHeaders,
21 body: finalBody,
22 ...rest,
23 });
24}
25
26function post(url, options = {}) {
27 return request(url, { ...options, method: 'POST' });

Callers 2

postFunction · 0.70
getFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected