-
-
Notifications
You must be signed in to change notification settings - Fork 746
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
Support for CancellationToken's #88
Comments
Right now, cancellation is supported via the IObservable interface (i.e. unsubscribing early from Observable == cancel the call). I'm not suuuuuuper excited to try to cram it in as a magic parameter |
WebAPI/MVC already does the magic parameter convention. If your web api method has a CancellationToken, it'll be populated so if the request dies, you can propagate it. For people using the Task method, we need a way to abort it... |
👍 On this. I currently workaround this by spawning a separate http client for each request, and binding the client's CancelPendingRequest method to the cancellationToken. It's ugly and inefficient, it'd be much nicer to just cancel the request I care about instead of all of them. |
Seems like this feature is implemented, right? I simply add a parameter of type CancellationToken to my method, or am I wrong? |
Should be, yes. |
We did it! |
I am a bit lost here. I am using Refit 2.4.1 in a Xamarin Forms project and I would like to be able to cancel http requests with a CancellationToken. So If I understand it correct I can add a CancellationToken parameter to the methods in the interface and then pass it in the implementation.
A small example would be highly appreciated. |
I just implemented it and based on that I can conclude the following:
|
Yes to all. Doesn't matter what the order of parameters is on your interface (they just get read out as a collection). |
Thank you Bennor. |
I'm having issues with this, if anybody could check it out I would appreciate some help: #339 |
If an interface method that supplies a CancellationToken, Refit should pass it to the underlying HttpClient call
The text was updated successfully, but these errors were encountered: