got-fetch icon indicating copy to clipboard operation
got-fetch copied to clipboard

got-fetch ignores retry setting of extended got

Open golyshevd opened this issue 1 year ago • 1 comments

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 | });

golyshevd avatar Jul 04 '23 17:07 golyshevd

I confirm this happens to me too

2snEM6 avatar Nov 20 '23 15:11 2snEM6