MCPcopy
hub / github.com/algorithm-visualizer/algorithm-visualizer / request

Function request

src/apis/index.js:6–13  ·  view source on GitHub ↗
(url, process)

Source from the content-addressed store, hash-verified

4axios.interceptors.response.use(response => response.data);
5
6const request = (url, process) => {
7 const tokens = url.split('/');
8 const baseURL = /^https?:\/\//i.test(url) ? '' : '/api';
9 return (...args) => {
10 const mappedURL = baseURL + tokens.map((token, i) => token.startsWith(':') ? args.shift() : token).join('/');
11 return Promise.resolve(process(mappedURL, args));
12 };
13};
14
15const GET = URL => {
16 return request(URL, (mappedURL, args) => {

Callers 5

GETFunction · 0.85
DELETEFunction · 0.85
POSTFunction · 0.85
PUTFunction · 0.85
PATCHFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected