got-fetch
got-fetch copied to clipboard
got-fetch ignores retry setting of extended got
Test case:
it.only('Should support retries', async () => {
nock('https://unstable.com')
.get('/v1/unstable')
.times(1)
.reply(StatusCodes.INTERNAL_SERVER_ERROR)
.get('/v1/unstable')
.times(1)
.reply(StatusCodes.OK);
const fetch = createFetch(
got.extend({
retry: {
limit: 5,
methods: ['GET'],
},
})
);
const { status } = await fetch('https://unstable.com/v1/unstable', {
method: 'GET',
});
expect(status).toEqual(StatusCodes.OK);
});
Is fails like this:
createFetch
✕ Should support retries (16 ms)
● RestDataSource › createFetch › Should support retries
expect(received).toEqual(expected) // deep equality
Expected: 200
Received: 500
85 | });
86 |
> 87 | expect(status).toEqual(StatusCodes.OK);
| ^
88 | });
89 | });
90 | });
I confirm this happens to me too