Address some static analysis and TODOs (#12)

This commit is contained in:
Stephen Toub 2025-03-20 23:09:38 -04:00 • committed by GitHub
commit 33b9582199
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,14 +8,12 @@ public class MockHttpHandler : HttpMessageHandler
{
if (RequestHandler == null)
throw new InvalidOperationException($"No {nameof(RequestHandler)} was set! Please set handler first and make request afterwards.");
if (cancellationToken.IsCancellationRequested)
throw new OperationCanceledException(cancellationToken);
cancellationToken.ThrowIfCancellationRequested();
var result = await RequestHandler.Invoke(request);
if (cancellationToken.IsCancellationRequested)
throw new OperationCanceledException(cancellationToken);
cancellationToken.ThrowIfCancellationRequested();
return result;
}