Skip to content

Commit 8c8adec

Browse files
joerg1985diemol
andauthored
[grid] handle baseRoute like the hubRoute and the graphqlRoute (#13772)
Co-authored-by: Diego Molina <[email protected]>
1 parent 44eba59 commit 8c8adec

File tree

4 files changed

+7
-16
lines changed

4 files changed

+7
-16
lines changed

java/src/org/openqa/selenium/grid/TemplateGridServerCommand.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ private static Routable buildRoute(String url, String prefix, Function<String, R
6969
}
7070

7171
protected static Routable baseRoute(String prefix, Route route) {
72-
return Route.prefix(prefix).to(route);
72+
if (prefix.isEmpty()) {
73+
return route;
74+
}
75+
return Route.combine(route, Route.prefix(prefix).to(route));
7376
}
7477

7578
protected abstract Handlers createHandlers(Config config);

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,12 @@ protected Handlers createHandlers(Config config) {
187187

188188
Routable appendRoute =
189189
Stream.of(
190-
routerWithSpecChecks,
190+
baseRoute(subPath, combine(routerWithSpecChecks)),
191191
hubRoute(subPath, combine(routerWithSpecChecks)),
192192
graphqlRoute(subPath, () -> graphqlHandler))
193193
.reduce(Route::combine)
194194
.get();
195195

196-
if (!subPath.isEmpty()) {
197-
appendRoute = Route.combine(appendRoute, baseRoute(subPath, combine(routerWithSpecChecks)));
198-
}
199-
200196
Routable httpHandler;
201197
if (routerOptions.disableUi()) {
202198
LOG.info("Grid UI has been disabled.");

java/src/org/openqa/selenium/grid/commands/Standalone.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,12 @@ protected Handlers createHandlers(Config config) {
192192

193193
Routable appendRoute =
194194
Stream.of(
195-
router,
195+
baseRoute(subPath, combine(router)),
196196
hubRoute(subPath, combine(router)),
197197
graphqlRoute(subPath, () -> graphqlHandler))
198198
.reduce(Route::combine)
199199
.get();
200200

201-
if (!subPath.isEmpty()) {
202-
appendRoute = Route.combine(appendRoute, baseRoute(subPath, combine(router)));
203-
}
204-
205201
Routable httpHandler;
206202
if (routerOptions.disableUi()) {
207203
LOG.info("Grid UI has been disabled.");

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,12 @@ protected Handlers createHandlers(Config config) {
149149

150150
Routable appendRoute =
151151
Stream.of(
152-
routerWithSpecChecks,
152+
baseRoute(subPath, combine(routerWithSpecChecks)),
153153
hubRoute(subPath, combine(routerWithSpecChecks)),
154154
graphqlRoute(subPath, () -> graphqlHandler))
155155
.reduce(Route::combine)
156156
.get();
157157

158-
if (!subPath.isEmpty()) {
159-
appendRoute = Route.combine(appendRoute, baseRoute(subPath, combine(routerWithSpecChecks)));
160-
}
161-
162158
Routable route;
163159
if (routerOptions.disableUi()) {
164160
LOG.info("Grid UI has been disabled.");

0 commit comments

Comments
 (0)