Skip to content

Use the value of the Retry-After header when present#47

Open
mschroeder223 wants to merge 4 commits into
rodion-m:masterfrom
birdie-buddy-app:feat/retry-after
Open

Use the value of the Retry-After header when present#47
mschroeder223 wants to merge 4 commits into
rodion-m:masterfrom
birdie-buddy-app:feat/retry-after

Conversation

@mschroeder223

Copy link
Copy Markdown

This PR modifies _getDelay to be passed the DioException and looks for the retry-after header in the response. When its present it attempts to parse it into seconds or an HTTP Date as per https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Retry-After If the header is not present or the header is malformed it falls back to the Duration based on the attempt.

I added test coverage as well using httpbun.com to respond with a 429 and different values of retry-after headers.
I believe this should be backwards compatible.

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

Successfully merging this pull request may close these issues.

1 participant