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

fix: Fix retry-handler.js when retry-after header is a Date #4084

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fgiova
Copy link

@fgiova fgiova commented Mar 6, 2025

Rationale

Fix retry-handler when retry-after header is a Date

Changes

Fix using original header retry-after for calculate timeout instead header casted to Number

Bug Fixes

Fix using original header retry-after for calculate timeout instead header casted to Number

Status

Copy link
Member

@metcoder95 metcoder95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a testing for it?

@@ -124,7 +124,7 @@ class RetryHandler {
if (retryAfterHeader) {
retryAfterHeader = Number(retryAfterHeader)
retryAfterHeader = Number.isNaN(retryAfterHeader)
? calculateRetryAfterHeader(retryAfterHeader)
? calculateRetryAfterHeader(headers['retry-after'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a proper check and parsing for it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Into tests?

@fgiova
Copy link
Author

fgiova commented Mar 6, 2025

Can you add a testing for?

I also fixed the related test; it now waits only 1ms, even though the date parser has failed. In fact Number(iso-date) has become NaN on function to evaluate retry-after header.

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.

2 participants