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

add option to use cancellation token in ChopperClient #645

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

kfiross
Copy link

@kfiross kfiross commented Dec 16, 2024

This pull request includes significant changes to the chopper package to add support for request cancellation using cancellation tokens. The changes involve updating various parts of the codebase to integrate the new cancellation_token_http package and modifying existing methods to support cancellation functionality.

Integration of cancellation tokens:

  • chopper/lib/src/base.dart: Added a _cancellationToken field and updated the ChopperClient constructor to accept an optional cancellationToken. Modified the execute method to handle cancellation and added a cancelRequests method to cancel ongoing requests. [1] [2] [3] [4] [5] [6]

  • chopper/lib/src/chain/call.dart: Updated the execute method to accept an optional cancellationToken parameter and pass it to the HttpCallInterceptor. [1] [2] [3]

Updates to interceptors:

Example and test updates:

Dependency updates:

@techouse
Copy link
Collaborator

techouse commented Dec 17, 2024

Hey,

I love the idea of a cancellation token, however, I'm not a fan of using a fork of the http package by default.

I was really hoping for dart-lang/http#978 to be merged by now. 🥺

Could you maybe create an opt-in plugin instead?

@techouse techouse linked an issue Dec 17, 2024 that may be closed by this pull request
@techouse techouse added the enhancement New feature or request label Dec 18, 2024
@techouse techouse self-assigned this Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cancel/Abort request
2 participants