Soneso / stellar_flutter_sdk

Stellar SDK for flutter - dart, Stellar, Horizon, Soneso
MIT License
71 stars 33 forks source link

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

Closed ydag closed 7 months ago

ydag commented 8 months ago

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:

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: