Skip to content

Commit e34cf27

Browse files
Don't set request timeout for PUT and POST
The current stuck request timeout does not handle the missing server hello case but it fixes the problem with stuck requests other than PUT and POST.
1 parent 5149ba1 commit e34cf27

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/common/http-client.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,16 @@ export class HttpClient implements Server.IHttpClient {
134134
const requestObj = request(options);
135135
cleanupRequestData.req = requestObj;
136136

137-
stuckRequestTimerId = setTimeout(() => {
138-
clearTimeout(stuckRequestTimerId);
139-
stuckRequestTimerId = null;
140-
if (!hasResponse) {
141-
this.setResponseResult(promiseActions, cleanupRequestData, { err: new Error(HttpClient.STUCK_REQUEST_ERROR_MESSAGE) });
142-
}
143-
}, options.timeout || HttpClient.STUCK_REQUEST_TIMEOUT);
144-
cleanupRequestData.timers.push(stuckRequestTimerId);
137+
if (options.method !== "PUT" && options.method !== "POST") {
138+
stuckRequestTimerId = setTimeout(() => {
139+
clearTimeout(stuckRequestTimerId);
140+
stuckRequestTimerId = null;
141+
if (!hasResponse) {
142+
this.setResponseResult(promiseActions, cleanupRequestData, { err: new Error(HttpClient.STUCK_REQUEST_ERROR_MESSAGE) });
143+
}
144+
}, options.timeout || HttpClient.STUCK_REQUEST_TIMEOUT);
145+
cleanupRequestData.timers.push(stuckRequestTimerId);
146+
}
145147

146148
requestObj
147149
.on("error", (err: IHttpRequestError) => {

0 commit comments

Comments
 (0)