Description
No method in the library accepts a CancellationToken. This means callers cannot cancel in-flight requests (e.g. when a user navigates away, a timeout fires, or a service shuts down), and the underlying HttpClient calls that do support cancellation cannot be wired up.
Proposed Change
Add an optional CancellationToken parameter (defaulting to CancellationToken.None) to every public async method:
// Before
public static async Task<HttpResponseMessage> GetAsync(string Route)
// After
public static async Task<HttpResponseMessage> GetAsync(string Route, CancellationToken cancellationToken = default)
Pass it through to the underlying HttpClient call:
var httpResponse = await httpClient.GetAsync(new Uri(Route), cancellationToken);
Scope
All public async methods across Get.cs, Post.cs, Put.cs, Patch.cs, Delete.cs.
Acceptance Criteria
Description
No method in the library accepts a
CancellationToken. This means callers cannot cancel in-flight requests (e.g. when a user navigates away, a timeout fires, or a service shuts down), and the underlyingHttpClientcalls that do support cancellation cannot be wired up.Proposed Change
Add an optional
CancellationTokenparameter (defaulting toCancellationToken.None) to every publicasyncmethod:Pass it through to the underlying
HttpClientcall:Scope
All public
asyncmethods acrossGet.cs,Post.cs,Put.cs,Patch.cs,Delete.cs.Acceptance Criteria
asyncmethod has aCancellationToken cancellationToken = defaultparameterHttpClientmethodOperationCanceledExceptionis thrown when token is cancelled)