Skip to content

Commit

Permalink
Merge 507ef30 into 44eba59
Browse files Browse the repository at this point in the history
  • Loading branch information
joerg1985 authored Apr 6, 2024
2 parents 44eba59 + 507ef30 commit 934f792
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ private static Routable buildRoute(String url, String prefix, Function<String, R
}

protected static Routable baseRoute(String prefix, Route route) {
return Route.prefix(prefix).to(route);
if (prefix.isEmpty()) {
return route;
}
return Route.combine(route, Route.prefix(prefix).to(route));
}

protected abstract Handlers createHandlers(Config config);
Expand Down
6 changes: 1 addition & 5 deletions java/src/org/openqa/selenium/grid/commands/Hub.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,12 @@ protected Handlers createHandlers(Config config) {

Routable appendRoute =
Stream.of(
routerWithSpecChecks,
baseRoute(subPath, combine(routerWithSpecChecks)),
hubRoute(subPath, combine(routerWithSpecChecks)),
graphqlRoute(subPath, () -> graphqlHandler))
.reduce(Route::combine)
.get();

if (!subPath.isEmpty()) {
appendRoute = Route.combine(appendRoute, baseRoute(subPath, combine(routerWithSpecChecks)));
}

Routable httpHandler;
if (routerOptions.disableUi()) {
LOG.info("Grid UI has been disabled.");
Expand Down
6 changes: 1 addition & 5 deletions java/src/org/openqa/selenium/grid/commands/Standalone.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,12 @@ protected Handlers createHandlers(Config config) {

Routable appendRoute =
Stream.of(
router,
baseRoute(subPath, combine(router)),
hubRoute(subPath, combine(router)),
graphqlRoute(subPath, () -> graphqlHandler))
.reduce(Route::combine)
.get();

if (!subPath.isEmpty()) {
appendRoute = Route.combine(appendRoute, baseRoute(subPath, combine(router)));
}

Routable httpHandler;
if (routerOptions.disableUi()) {
LOG.info("Grid UI has been disabled.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,12 @@ protected Handlers createHandlers(Config config) {

Routable appendRoute =
Stream.of(
routerWithSpecChecks,
baseRoute(subPath, combine(routerWithSpecChecks)),
hubRoute(subPath, combine(routerWithSpecChecks)),
graphqlRoute(subPath, () -> graphqlHandler))
.reduce(Route::combine)
.get();

if (!subPath.isEmpty()) {
appendRoute = Route.combine(appendRoute, baseRoute(subPath, combine(routerWithSpecChecks)));
}

Routable route;
if (routerOptions.disableUi()) {
LOG.info("Grid UI has been disabled.");
Expand Down

0 comments on commit 934f792

Please sign in to comment.