public static HttpClientHandler GetHttpClientHandler(IApiProxyConfiguration configuration, ICredentials credentials = null, EventHandler <RequestReceivedEventArgs> requestReceivedEventHandler = null) { var clientHandler = new ApiProxyClientHandler(configuration) { Credentials = credentials, PreAuthenticate = true }; if (requestReceivedEventHandler != null) { clientHandler.RequestReceived += requestReceivedEventHandler; } return(clientHandler); }
public static HttpClient GetHttpClient(IApiProxyConfiguration configuration, ICredentials credentials = null, EventHandler <RequestReceivedEventArgs> requestReceivedEventHandler = null) { var baseUri = configuration.DefaultApiAddress ?? new Uri("https://localhost/"); var clientHandler = new ApiProxyClientHandler(configuration) { Credentials = credentials, PreAuthenticate = true }; if (requestReceivedEventHandler != null) { clientHandler.RequestReceived += requestReceivedEventHandler; } return(new HttpClient(clientHandler) { BaseAddress = baseUri }); }