http_interceptor icon indicating copy to clipboard operation
http_interceptor copied to clipboard

_retryCount is shared between multiple requests making it dangerous to infinite requests

Open itsUndefined opened this issue 6 months ago • 1 comments

Describe the bug Because _retryCount is not local var to _attemptRequest, it's possible to create infinite loops since a new request restarts the _retryCount to 0 for all pending requests.

To Reproduce

  1. Add a shouldAttemptRetryOnResponse that starts a new request with the same intercepted client that succeeds ( e.g. a refresh )
  2. Make an api request that fails all the time and calls shouldAttemptRetryOnResponse
  3. Observe infinite looping

Expected behavior I expected that after maxRetryAttempts attempts of the original request, the request would be cancelled

Please complete the following information):

  • Flutter version: 3.35.4
  • http_interceptor: 2.0.0

itsUndefined avatar Sep 26 '25 09:09 itsUndefined