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

429 Response Handling Fails on Missing retry-after Header #78

Closed
ydag opened this issue Nov 1, 2023 · 0 comments
Closed

429 Response Handling Fails on Missing retry-after Header #78

ydag opened this issue Nov 1, 2023 · 0 comments

Comments

@ydag
Copy link
Contributor

ydag commented Nov 1, 2023

When processing an HTTP response with a 429 (Too Many Requests) status code, the SDK's internal handleResponse function attempts to throw a TooManyRequestsException. This exception expects a retry-after header to set the _retryAfter property. However, if the response lacks the retry-after header, the SDK generates a Null check operator used on a null value exception due to the null assertion on the retry-after header value. This behaviour might lead to unexpected errors for developers using the SDK.

Steps to Reproduce:

  • Trigger a request resulting in a 429 status code response without the retry-after header using the SDK's public-facing functions.
  • Observe the "Null check operator used on a null value" exception.

Expected Behavior:
The SDK should handle a 429 status code, regardless of the retry-after header's presence or absence.

Actual Behavior:
The SDK raises a null assertion error due to the absent retry-after header.

Suggested Fix:

  • Make the _retryAfter property nullable and manage cases where the retry-after header is not present.
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

1 participant