How to use Flurl with Polly without factory
Asked Answered
E

0

0

Following from Set a default Polly policy with Flurl

How do I use Polly with Flurl without the factory? This only calls it once

string s = await Policy
                        .Handle<HttpRequestException> ()
                        .OrResult <HttpResponseMessage> (r => !r.IsSuccessStatusCode)
                        .RetryAsync (5)
                        .ExecuteAsync (() => { Console.WriteLine ("Retry"); return "http://127.0.0:7071/".GetAsync (); })
                        .ReceiveString ()
                        .ConfigureAwait (false);
Externalize answered 17/4, 2019 at 0:49 Comment(4)
Have you tried Handle<FlurlHttpException> instead? That is what you want to catch in this scenario instead of HttpRequestException. I might not have explained that very well in the comments in the question you linked to.Merras
ok, got it working. thanksExternalize
@Externalize why don't you answer your own question so that other people can learnCaia
Does this answer your question? How to use Polly with Flurl.Http?Amado

© 2022 - 2024 — McMap. All rights reserved.