MCPcopy Create free account
hub / github.com/BrainicHQ/DoHSpeedTest / withTimeout

Function withTimeout

script.js:1163–1169  ·  view source on GitHub ↗
(input, options = {})

Source from the content-addressed store, hash-verified

1161 })();
1162
1163 const withTimeout = async (input, options = {}) => {
1164 const controller = new AbortController();
1165 const timer = setTimeout(() => controller.abort(), 4000);
1166 try { return await fetch(input, { ...options, signal: controller.signal }); }
1167 catch (error) { console.error('Capability test error', { input, options, error }); return null; }
1168 finally { clearTimeout(timer); }
1169 };
1170
1171 const testGet = async (mode) => {
1172 const urlToUse = usesJsonApi ? jsonGetUrl : wireGetUrl;

Callers 2

testGetFunction · 0.85
testPostCorsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected