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

[java] allow setting version in the Http Client Config #12919

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 4 additions & 5 deletions java/src/org/openqa/selenium/remote/http/ClientConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.http.HttpClient;
import java.time.Duration;
import javax.net.ssl.SSLContext;
import org.openqa.selenium.Credentials;
Expand All @@ -40,7 +39,7 @@ public class ClientConfig {
private final Proxy proxy;
private final Credentials credentials;
private final SSLContext sslContext;
private HttpClient.Version version;
private String version;
titusfortner marked this conversation as resolved.
Show resolved Hide resolved

protected ClientConfig(
URI baseUri,
Expand All @@ -50,7 +49,7 @@ protected ClientConfig(
Proxy proxy,
Credentials credentials,
SSLContext sslContext,
HttpClient.Version version) {
String version) {
this.baseUri = baseUri;
this.connectionTimeout = Require.nonNegative("Connection timeout", connectionTimeout);
this.readTimeout = Require.nonNegative("Read timeout", readTimeout);
Expand Down Expand Up @@ -214,7 +213,7 @@ public SSLContext sslContext() {
return sslContext;
}

public ClientConfig version(HttpClient.Version version) {
public ClientConfig version(String version) {
return new ClientConfig(
baseUri,
connectionTimeout,
Expand All @@ -226,7 +225,7 @@ public ClientConfig version(HttpClient.Version version) {
Require.nonNull("Version", version));
}

public HttpClient.Version version() {
public String version() {
return version;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {
builder.sslContext(sslContext);
}

Version version = config.version();
String version = config.version();
titusfortner marked this conversation as resolved.
Show resolved Hide resolved
if (version != null) {
builder.version(version);
builder.version(Version.valueOf(version));
}

this.client = builder.build();
Expand Down
Loading