Skip to content

Commit

Permalink
Changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
beiske committed Jun 28, 2018
1 parent 77e0384 commit 1f5410e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -796,8 +796,15 @@ static URI buildUri(String pathPrefix, String path, Map<String, String> params)
Objects.requireNonNull(path, "path must not be null");
try {
String fullPath;
if (pathPrefix != null && !pathPrefix.isEmpty()) {
if (pathPrefix != null && pathPrefix.isEmpty() == false) {
fullPath = (pathPrefix + "/" + path).replaceAll("//+", "/");
if (pathPrefix.endsWith("/") && path.startsWith("/")) {
fullPath = pathPrefix.substring(0, pathPrefix.length() - 1) + path;
} else if (pathPrefix.endsWith("/") || path.startsWith("/")) {
fullPath = pathPrefix + path;
} else {
fullPath = pathPrefix + "/" + path;
}
} else {
fullPath = path;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,8 @@ private void waitForClusterStateUpdatesToFinish() throws Exception {
*/
protected Settings restClientSettings() {
Settings.Builder builder = Settings.builder();
if (System.getProperty("tests.rest.client.path.prefix") != null) {
builder.put(CLIENT_PATH_PREFIX, System.getProperty("tests.rest.client.path.prefix"));
if (System.getProperty("tests.rest.client_path_prefix") != null) {
builder.put(CLIENT_PATH_PREFIX, System.getProperty("tests.rest.client_path_prefix"));
}
return builder.build();
}
Expand Down

0 comments on commit 1f5410e

Please sign in to comment.