We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eca1400 commit efc829aCopy full SHA for efc829a
packages/node-http-handler/src/node-http2-handler.ts
@@ -66,7 +66,17 @@ export class NodeHttp2Handler
66
67
req.on("error", reject);
68
69
- // TODO: wire-up any timeout logic
+ const { connectionTimeout } = this.httpOptions;
70
+ if (connectionTimeout) {
71
+ req.setTimeout(connectionTimeout, () => {
72
+ req.close();
73
+ const timeoutError = new Error(
74
+ `Stream timed out because of no activity for ${connectionTimeout} ms`
75
+ );
76
+ timeoutError.name = "TimeoutError";
77
+ reject(timeoutError);
78
+ });
79
+ }
80
// TODO: wire-up any abort logic
81
82
writeRequestBody(req, request);
0 commit comments