Mirror: A Node.js fetch shim using built-in Request, Response, and Headers (but without native fetch)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: Add default timeout (#12)

authored by

Phil Pluckthun and committed by
GitHub
f4fea96a 1ebaff45

+8 -2
+5
.changeset/cool-breads-dream.md
··· 1 + --- 2 + 'fetch-nodeshim': patch 3 + --- 4 + 5 + Add sane default timeout to `http.request`
+2 -2
src/agent.ts
··· 57 57 } 58 58 }; 59 59 60 - const defaultAgentOpts = { 60 + export const defaultAgentOpts = { 61 61 keepAlive: true, 62 62 keepAliveMsecs: 1000, 63 63 }; ··· 145 145 setHost: false, 146 146 agent: false, 147 147 proxyEnv: {}, 148 - timeout: 8_000, 148 + timeout: 5_000, 149 149 headers: proxyHeaders, 150 150 servername: proxy.protocol === 'https:' ? proxy.hostname : undefined, 151 151 };
+1
src/fetch.ts
··· 127 127 ); 128 128 const requestOptions = { 129 129 ...urlToHttpOptions(requestUrl), 130 + timeout: 5_000, 130 131 method: methodToHttpOption( 131 132 initFromRequest ? input.method : requestInit?.method 132 133 ),