diff --git a/src/channel/httpBeaconChannel.ts b/src/channel/httpBeaconChannel.ts index bf7e4536..d3eef36e 100644 --- a/src/channel/httpBeaconChannel.ts +++ b/src/channel/httpBeaconChannel.ts @@ -122,7 +122,7 @@ export class HttpBeaconChannel implements DuplexChannel= 500 || status === 429 || status === 408; + // Retry on any server error and client errors 429 (rate limit), 408 (request timeout) and 401 (unauthorized) + return status >= 500 || status === 429 || status === 408 || status === 401; } } diff --git a/test/channel/httpBeaconChannel.test.ts b/test/channel/httpBeaconChannel.test.ts index cc908868..bce67e28 100644 --- a/test/channel/httpBeaconChannel.test.ts +++ b/test/channel/httpBeaconChannel.test.ts @@ -180,10 +180,6 @@ describe('An HTTP beacon channel', () => { title: 'Invalid token', log: 'Beacon rejected with non-retryable status: Invalid token', }, - { - status: 401, - title: 'Unauthorized request', - }, { status: 402, title: 'Payment overdue', @@ -254,6 +250,7 @@ describe('An HTTP beacon channel', () => { [408, 'Request timeout'], [503, 'Service unavailable'], [504, 'Gateway timeout'], + [401, 'Unauthorized'], ])('should report a retryable error if the response status is %i', async (status, title) => { fetchMock.mock(endpointUrl, { status: status,