MCPcopy Create free account
hub / github.com/deepclause/agentvm / withTimeout

Function withTimeout

test/network/http.test.js:9–14  ·  view source on GitHub ↗

* Comprehensive HTTP/HTTPS network tests * Tests various HTTP methods, headers, redirects, and downloads

(promise, ms = 30000)

Source from the content-addressed store, hash-verified

7 */
8
9function withTimeout(promise, ms = 30000) {
10 return Promise.race([
11 promise,
12 new Promise((_, reject) => setTimeout(() => reject(new Error(`Timeout after ${ms}ms`)), ms))
13 ]);
14}
15
16// Skip HTTPS tests by default since they may be slow (TLS handshake overhead)
17const INCLUDE_HTTPS = process.env.INCLUDE_HTTPS === '1';

Callers 1

testFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected