Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dotnet] Possibility to override underlying HttpClient/HttpClientHandler for all HTTP requests #15283

Merged
merged 5 commits into from
Feb 13, 2025
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion dotnet/src/webdriver/Remote/HttpCommandExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,12 @@ protected virtual void OnSendingRemoteHttpRequest(SendingRemoteHttpRequestEventA
this.SendingRemoteHttpRequest?.Invoke(this, eventArgs);
}

private HttpClient CreateHttpClient()
/// <summary>
/// Creates an instance of <see cref="HttpClientHandler"/> as underlying handler,
/// used by <see cref="CreateHttpClient"/>.
/// </summary>
/// <returns>An instance of <see cref="HttpClientHandler"/>.</returns>
protected virtual HttpClientHandler CreateHttpClientHandler()
{
HttpClientHandler httpClientHandler = new HttpClientHandler();
string userInfo = this.remoteServerUri.UserInfo;
Expand All @@ -234,6 +239,16 @@ private HttpClient CreateHttpClient()

httpClientHandler.Proxy = this.Proxy;

return httpClientHandler;
}
/// <summary>
/// Creates an instance of <see cref="HttpClient"/> used by making all HTTP calls to remote end.
/// </summary>
/// <returns>An instance of <see cref="HttpClient"/>.</returns>
protected virtual HttpClient CreateHttpClient()
{
var httpClientHandler = CreateHttpClientHandler();

HttpMessageHandler handler = httpClientHandler;

if (_logger.IsEnabled(LogEventLevel.Trace))
Expand Down
Loading