Skip to content

Commit 917106e

Browse files
committed
[grid] Adding "/wd/hub" route to RouterServer
Helps backwards compatibility and should facilitate users to start with Grid 4. Fixes SeleniumHQ/docker-selenium#1235
1 parent 4ec0cfc commit 917106e

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

java/server/src/org/openqa/selenium/grid/commands/Hub.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import com.google.auto.service.AutoService;
2121
import com.google.common.collect.ImmutableSet;
22+
2223
import org.openqa.selenium.BuildInfo;
2324
import org.openqa.selenium.cli.CliCommand;
2425
import org.openqa.selenium.events.EventBus;
@@ -179,11 +180,12 @@ protected Handlers createHandlers(Config config) {
179180
};
180181

181182
Routable ui = new GridUiRoute();
183+
Routable routerWithSpecChecks = router.with(networkOptions.getSpecComplianceChecks());
182184

183185
HttpHandler httpHandler = combine(
184186
ui,
185-
router.with(networkOptions.getSpecComplianceChecks()),
186-
Route.prefix("/wd/hub").to(combine(router.with(networkOptions.getSpecComplianceChecks()))),
187+
routerWithSpecChecks,
188+
Route.prefix("/wd/hub").to(combine(routerWithSpecChecks)),
187189
Route.options("/graphql").to(() -> graphqlHandler),
188190
Route.post("/graphql").to(() -> graphqlHandler),
189191
Route.get("/readyz").to(() -> readinessCheck));

java/server/src/org/openqa/selenium/grid/router/httpd/RouterServer.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.google.auto.service.AutoService;
2121
import com.google.common.collect.ImmutableMap;
2222
import com.google.common.collect.ImmutableSet;
23+
2324
import org.openqa.selenium.BuildInfo;
2425
import org.openqa.selenium.cli.CliCommand;
2526
import org.openqa.selenium.grid.TemplateGridServerCommand;
@@ -63,6 +64,7 @@
6364
import static org.openqa.selenium.grid.config.StandardGridRoles.SESSION_MAP_ROLE;
6465
import static org.openqa.selenium.grid.config.StandardGridRoles.SESSION_QUEUER_ROLE;
6566
import static org.openqa.selenium.net.Urls.fromUri;
67+
import static org.openqa.selenium.remote.http.Route.combine;
6668
import static org.openqa.selenium.remote.http.Route.get;
6769

6870
@AutoService(CliCommand.class)
@@ -143,10 +145,13 @@ protected Handlers createHandlers(Config config) {
143145
getServerVersion());
144146

145147
Routable ui = new GridUiRoute();
148+
Routable routerWithSpecChecks = new Router(tracer, clientFactory, sessions, queuer, distributor)
149+
.with(networkOptions.getSpecComplianceChecks());
146150

147151
Route handler = Route.combine(
148152
ui,
149-
new Router(tracer, clientFactory, sessions, queuer, distributor).with(networkOptions.getSpecComplianceChecks()),
153+
routerWithSpecChecks,
154+
Route.prefix("/wd/hub").to(combine(routerWithSpecChecks)),
150155
Route.options("/graphql").to(() -> graphqlHandler),
151156
Route.post("/graphql").to(() -> graphqlHandler),
152157
get("/readyz").to(() -> req -> new HttpResponse().setStatus(HTTP_NO_CONTENT)));

0 commit comments

Comments
 (0)