diff --git a/src/lib/client.spec.ts b/src/lib/client.spec.ts index 1ac4b0e..1f9414c 100644 --- a/src/lib/client.spec.ts +++ b/src/lib/client.spec.ts @@ -16,10 +16,7 @@ describe('deliverParcel', () => { stubAxiosPost.mockResolvedValueOnce(stubResponse); // @ts-ignore - jest.spyOn(axios, 'create').mockReturnValueOnce({ - interceptors: { response: { use: jest.fn() } } as any, - post: stubAxiosPost, - }); + jest.spyOn(axios, 'create').mockReturnValueOnce({ post: stubAxiosPost }); }); afterEach(() => { @@ -85,14 +82,6 @@ describe('deliverParcel', () => { expect(agent).toHaveProperty('keepAlive', true); }); - test('An interceptor that removes the request and response should be registered', async () => { - ((axios.create as any) as jest.MockInstance).mockRestore(); - - await expect(deliverParcel('https://httpstat.us/500', body)).rejects.not.toHaveProperty( - 'jse_cause.config', - ); - }); - describe('POHTTP_TLS_REQUIRED', () => { test('Non-TLS URLs should be refused if POHTTP_TLS_REQUIRED is undefined', async () => { mockEnvVars({}); diff --git a/src/lib/client.ts b/src/lib/client.ts index a31d9b2..c55cfda 100644 --- a/src/lib/client.ts +++ b/src/lib/client.ts @@ -33,13 +33,6 @@ export async function deliverParcel( headers: { 'Content-Type': 'application/vnd.relaynet.parcel' }, httpsAgent: new https.Agent({ keepAlive: true }), }); - - // Remove the request and response from the error cause to avoid filling the logs with - // unnecessary information. See: https://github.com/axios/axios/issues/2602 - axiosInstance.interceptors.response.use(undefined, async error => - Promise.reject(new Error(error.message)), - ); - const response = await postRequest(targetNodeUrl, parcelSerialized, axiosInstance, axiosOptions); if (response.status === 307 || response.status === 308) { throw new PoHTTPError(`Reached maximum number of redirects (${axiosOptions.maxRedirects})`);