11 references to HttpClientHedgingResiliencePredicates
Microsoft.Extensions.Http.Resilience (1)
Hedging\HttpHedgingStrategyOptions.cs (1)
27
ShouldHandle = args => new ValueTask<bool>(
HttpClientHedgingResiliencePredicates
.IsTransient(args.Outcome, args.Context.CancellationToken));
Microsoft.Extensions.Http.Resilience.Tests (10)
Hedging\HttpClientHedgingResiliencePredicatesTests.cs (10)
20
Assert.True(
HttpClientHedgingResiliencePredicates
.IsTransientHttpException(new TimeoutRejectedException()));
21
Assert.True(
HttpClientHedgingResiliencePredicates
.IsTransientHttpException(new BrokenCircuitException()));
22
Assert.True(
HttpClientHedgingResiliencePredicates
.IsTransientHttpException(new HttpRequestException()));
23
Assert.False(
HttpClientHedgingResiliencePredicates
.IsTransientHttpException(new InvalidOperationException()));
29
Assert.True(
HttpClientHedgingResiliencePredicates
.IsTransient(Outcome.FromException<HttpResponseMessage>(new TimeoutRejectedException())));
30
Assert.True(
HttpClientHedgingResiliencePredicates
.IsTransient(Outcome.FromException<HttpResponseMessage>(new BrokenCircuitException())));
31
Assert.True(
HttpClientHedgingResiliencePredicates
.IsTransient(Outcome.FromException<HttpResponseMessage>(new HttpRequestException())));
32
Assert.False(
HttpClientHedgingResiliencePredicates
.IsTransient(Outcome.FromException<HttpResponseMessage>(new InvalidOperationException())));
33
Assert.False(
HttpClientHedgingResiliencePredicates
.IsTransient(Outcome.FromResult<HttpResponseMessage>(null)));
43
HttpClientHedgingResiliencePredicates
.IsTransient(Outcome.FromResult(response)).Should().Be(expected);