HttpClientHandler

HttpClient configuration is done using a HttpClientHandler, simply create an instance of the HttpClientHandler and pass it in the Config constructor or UseHttpClientHandler extension method.

More information on HttpClientHandler

Example using a HttpClientHandler to populate cookies from the response to it’s CookieContainer:

var cookieContainer = new CookieContainer();
var httpClientHandler = new HttpClientHandler { CookieContainer = cookieContainer };

dynamic restClient = new RestClient("https://httpbin.org/cookies", new Config(httpClientHandler));

When using IHttpClientFactory use the UseHttpClientHandler extension method when adding the RestClient to your .NET Core DI container (usually in Startup.cs):

var cookieContainer = new CookieContainer();

services
      .AddRestClient("https://httpbin.org/cookies")
      .UseHttpClientHandler(() => new HttpClientHandler { CookieContainer = cookieContainer });

Note you can only add one HttpClientHandler to the pipeline