Skip to content

Commit

Permalink
[java] Fixing JSON to Proxy deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
barancev committed May 11, 2018
1 parent 3f04025 commit 66fcb62
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion java/client/src/org/openqa/selenium/Proxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

Expand Down Expand Up @@ -74,7 +75,14 @@ public Proxy(Map<String, ?> raw) {
setHttpProxy((String) raw.get("httpProxy"));
}
if (raw.containsKey("noProxy") && raw.get("noProxy") != null) {
setNoProxy((String) raw.get("noProxy"));
Object rawData = raw.get("noProxy");
if (rawData instanceof List) {
// w3c
setNoProxy(String.join(", ", (List) rawData));
} else {
// legacy
setNoProxy((String) rawData);
}
}
if (raw.containsKey("sslProxy") && raw.get("sslProxy") != null) {
setSslProxy((String) raw.get("sslProxy"));
Expand Down
2 changes: 1 addition & 1 deletion java/client/test/org/openqa/selenium/ProxySettingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void canConfigureManualHttpProxy() {
@NeedsLocalEnvironment
public void canConfigureNoProxy() {
Proxy proxyToUse = proxyServer.asProxy();
proxyToUse.setNoProxy("localhost, 127.0.0.*");
proxyToUse.setNoProxy("localhost, 127.0.0.1, " + appServer.getHostName());
Capabilities caps = new ImmutableCapabilities(PROXY, proxyToUse);

WebDriver driver = new WebDriverBuilder().get(caps);
Expand Down

0 comments on commit 66fcb62

Please sign in to comment.