diff --git a/packages/cache/__tests__/requestUtils.test.ts b/packages/cache/__tests__/requestUtils.test.ts index 05fc573b..34e5268c 100644 --- a/packages/cache/__tests__/requestUtils.test.ts +++ b/packages/cache/__tests__/requestUtils.test.ts @@ -122,7 +122,7 @@ test('retry fails after exhausting retries', async () => { }) test('retry fails after non-retryable status code', async () => { - await testRetryExpectingError([TestResponse(500), TestResponse(200, 'Ok')]) + await testRetryExpectingError([TestResponse(501), TestResponse(200, 'Ok')]) }) test('retry works after error', async () => { diff --git a/packages/cache/__tests__/saveCache.test.ts b/packages/cache/__tests__/saveCache.test.ts index 4d0027be..72fcfb2c 100644 --- a/packages/cache/__tests__/saveCache.test.ts +++ b/packages/cache/__tests__/saveCache.test.ts @@ -186,7 +186,7 @@ test('save with reserve cache failure should fail', async () => { .spyOn(cacheHttpClient, 'reserveCache') .mockImplementation(async () => { const response: TypedResponse = { - statusCode: 500, + statusCode: 501, result: null, headers: {} } @@ -228,7 +228,7 @@ test('save with server error should fail', async () => { .spyOn(cacheHttpClient, 'reserveCache') .mockImplementation(async () => { const response: TypedResponse = { - statusCode: 500, + statusCode: 501, result: {cacheId}, headers: {} } @@ -282,7 +282,7 @@ test('save with valid inputs uploads a cache', async () => { .spyOn(cacheHttpClient, 'reserveCache') .mockImplementation(async () => { const response: TypedResponse = { - statusCode: 500, + statusCode: 501, result: {cacheId}, headers: {} } diff --git a/packages/cache/src/internal/requestUtils.ts b/packages/cache/src/internal/requestUtils.ts index 043c8a7c..76813534 100644 --- a/packages/cache/src/internal/requestUtils.ts +++ b/packages/cache/src/internal/requestUtils.ts @@ -26,6 +26,7 @@ export function isRetryableStatusCode(statusCode?: number): boolean { return false } const retryableStatusCodes = [ + HttpCodes.InternalServerError, HttpCodes.BadGateway, HttpCodes.ServiceUnavailable, HttpCodes.GatewayTimeout