Skip to content

Commit

Permalink
[Grid] Changing host header before forwarding commands to the driver
Browse files Browse the repository at this point in the history
A better fix for commit
f2a7e5e
  • Loading branch information
diemol committed May 28, 2020
1 parent c87a3c6 commit 4723c25
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -30,6 +30,8 @@
import org.openqa.selenium.remote.tracing.Tracer;

import java.net.URL;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

import static org.openqa.selenium.remote.http.HttpMethod.DELETE;

Expand Down Expand Up @@ -62,7 +64,10 @@ protected ProtocolConvertingSession(
@Override
public HttpResponse execute(HttpRequest req) {
String host = "host";
req.removeHeader(host);
StreamSupport.stream(req.getHeaderNames().spliterator(), true)
.filter(host::equalsIgnoreCase)
.collect(Collectors.toList())
.forEach(req::removeHeader);
req.addHeader(host, String.format("%s:%s", getUri().getHost(), getUri().getPort()));
HttpResponse res = handler.execute(req);
if (req.getMethod() == DELETE && killUrl.equals(req.getUri())) {
Expand Down

0 comments on commit 4723c25

Please sign in to comment.