Skip to content
This repository was archived by the owner on Jul 20, 2025. It is now read-only.
This repository was archived by the owner on Jul 20, 2025. It is now read-only.

got-fetch ignores retry setting of extended got #358

@golyshevd

Description

@golyshevd

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions