Search code examples
c#httpdotnet-httpclientflurl

How to use Flurl with instance of HttpClient


Let's say I have an instance of HttpClient which is already configured. And now I want to use it for Flurl requests. I'd like to do something like this:

var poco = await httpClient.GetJsonAsync<POCO>();

Is this possible?


Solution

  • Sure...

    var flurlClient = new FlurlClient(httpClient);
    var poco = await flurlClient.Request(url).GetJsonAsync<POCO>();