Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I cancel a call to HttpClient.GetByteArrayAsync?

Tags:

c#

.net-4.5

I have a CancellationToken, but I don't see a way to pass it to HttpClient.GetByteArrayAsync. Which overload should I be using for this effect?

like image 813
Jonathan Allen Avatar asked Jul 21 '14 04:07

Jonathan Allen


1 Answers

This HttpClient method (as well as a some others) does not support cancellation yet. The feature has been requested. Until such time, should not be difficult to implement a custom version of it by copying GetByteArrayAsync and replacing with GetAsync variant that supports cancellation.

like image 163
Serge Pavlov Avatar answered Sep 21 '22 03:09

Serge Pavlov