MCPcopy
hub / github.com/lukeed/polka / send

Function send

examples/with-firebase-admin/client/utils/api.js:16–24  ·  view source on GitHub ↗
(method, uri, data, opts)

Source from the content-addressed store, hash-verified

14}
15
16function send(method, uri, data, opts) {
17 opts = opts || {};
18 opts.method = method;
19 opts.headers = HEADERS;
20 let token = getToken(); // fresh check on localstorage
21 token && (opts.headers.Authorization = `Bearer ${token}`);
22 data && (opts.body = JSON.stringify(data));
23 return fetch(`${API}${uri}`, opts).then(handle);
24}
25
26export const get = send.bind(null, 'get');
27export const put = send.bind(null, 'put');

Callers 8

send.jsFile · 0.85
send-type.jsFile · 0.85
index.jsFile · 0.85
items.jsFile · 0.85
index.jsFile · 0.85
items.jsFile · 0.85
services.jsFile · 0.85
index.jsFile · 0.85

Calls 1

getTokenFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…