Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[grid] handle baseRoute like the hubRoute and the graphqlRoute #13772

Merged
merged 4 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading