Skip to content

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

Description

@itsUndefined

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions