diff --git a/packages/node-http-handler/src/node-http-handler.ts b/packages/node-http-handler/src/node-http-handler.ts index 72049efebdb9..0db7cb40fa04 100644 --- a/packages/node-http-handler/src/node-http-handler.ts +++ b/packages/node-http-handler/src/node-http-handler.ts @@ -59,7 +59,7 @@ export class NodeHttpHandler implements HttpHandler { const maxSockets = 50; return { connectionTimeout, - socketTimeout, + socketTimeout: socketTimeout === undefined ? 10000 : socketTimeout, httpAgent: httpAgent || new hAgent({ keepAlive, maxSockets }), httpsAgent: httpsAgent || new hsAgent({ keepAlive, maxSockets }), }; diff --git a/packages/node-http-handler/src/node-http2-handler.spec.ts b/packages/node-http-handler/src/node-http2-handler.spec.ts index b8a5e01a302e..3eb6bd335763 100644 --- a/packages/node-http-handler/src/node-http2-handler.spec.ts +++ b/packages/node-http-handler/src/node-http2-handler.spec.ts @@ -374,7 +374,7 @@ describe(NodeHttp2Handler.name, () => { }); it("will throw reasonable error when connection aborted abnormally", async () => { - nodeH2Handler = new NodeHttp2Handler(); + nodeH2Handler = new NodeHttp2Handler({ requestTimeout: 0 }); // Create a session by sending a request. await nodeH2Handler.handle(new HttpRequest(getMockReqOptions()), {}); const authority = `${protocol}//${hostname}:${port}`; @@ -399,7 +399,7 @@ describe(NodeHttp2Handler.name, () => { }); it("will throw reasonable error when frameError is thrown", async () => { - nodeH2Handler = new NodeHttp2Handler(); + nodeH2Handler = new NodeHttp2Handler({ requestTimeout: 0 }); // Create a session by sending a request. await nodeH2Handler.handle(new HttpRequest(getMockReqOptions()), {}); const authority = `${protocol}//${hostname}:${port}`; diff --git a/packages/node-http-handler/src/node-http2-handler.ts b/packages/node-http-handler/src/node-http2-handler.ts index 6d2afce12b70..8b6a815c4dd1 100644 --- a/packages/node-http-handler/src/node-http2-handler.ts +++ b/packages/node-http-handler/src/node-http2-handler.ts @@ -41,7 +41,7 @@ export class NodeHttp2Handler implements HttpHandler { private sessionCache: Map; constructor({ requestTimeout, sessionTimeout, disableConcurrentStreams }: NodeHttp2HandlerOptions = {}) { - this.requestTimeout = requestTimeout; + this.requestTimeout = requestTimeout === undefined ? 10000 : requestTimeout; this.sessionTimeout = sessionTimeout; this.disableConcurrentStreams = disableConcurrentStreams; this.sessionCache = new Map();