Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

307 Redirect #66

Closed
bradyclifford opened this issue Oct 25, 2021 · 1 comment
Closed

307 Redirect #66

bradyclifford opened this issue Oct 25, 2021 · 1 comment

Comments

@bradyclifford
Copy link

bradyclifford commented Oct 25, 2021

In some cases an API endpoint can return a 307 redirect with a location header to another endpoint. Currently, fetch-retry will reattempt using the original endpoint instead of the new location. Is there a way to update the original request with the new endpoint during a subsequent retry?

This of course is enabled by default with fetch.
https://developer.mozilla.org/en-US/docs/Web/API/fetch

image

@jonbern
Copy link
Owner

jonbern commented Nov 2, 2021

I would assume that unless you have configured fetch-retry to retry requests with a 307 status code, that the default behavior of the fetch implementation is what would be used.

Alternatively, if you are actively retrying 307 status codes, I think this is perhaps an edge-case where the current implementation falls short. By defining a custom retryOn function you get get a hold of the returned response object and get the Location header, but I don't see how you can replace the URL of the already wrapped fetch invocation.

@jonbern jonbern closed this as completed May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants