Skip to content

Commit 9bce91f

Browse files
fix: handle HTTP 304 response status code
In case 304 is returned, the cached version of the result should be used, so consider this response as success. NOTE: It can be returned only when specific header is sent in the request, so the caller actually expects to receive either 304 or 200 with new content.
1 parent 7d7ce8e commit 9bce91f

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/common/constants.ts

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export class Proxy {
9292
*/
9393
export class HttpStatusCodes {
9494
static SEE_OTHER = 303;
95+
static NOT_MODIFIED = 304;
9596
static PAYMENT_REQUIRED = 402;
9697
static PROXY_AUTHENTICATION_REQUIRED = 407;
9798
}

lib/common/http-client.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export class HttpClient implements Server.IHttpClient {
168168
this.setResponseResult(promiseActions, cleanupRequestData, { err: new Error(HttpClient.STUCK_RESPONSE_ERROR_MESSAGE) });
169169
}
170170
}, HttpClient.STUCK_RESPONSE_CHECK_INTERVAL);
171-
const successful = helpers.isRequestSuccessful(responseData);
171+
const successful = helpers.isRequestSuccessful(responseData) || responseData.statusCode === HttpStatusCodes.NOT_MODIFIED;
172172
if (!successful) {
173173
pipeTo = undefined;
174174
}

0 commit comments

Comments
 (0)