docs: public static String appendUri(final String baseUri, String path, final boolean escapeDoubleSlash) {
          String resultUri = baseUri;
          if (path != null && path.length() > 0) {
              if (path.startsWith("/")) {
                  // trim the trailing slash in baseUri, since the path already starts with a slash
                  if (resultUri.endsWith("/")) {
                      resultUri = resultUri.substring(0, resultUri.length() - 1);
                  }
              } else if (!resultUri.endsWith("/")) {
                  resultUri += "/";
              }
              if (escapeDoubleSlash) {
                  resultUri += path.replace("//", "/%2F");
              } else {
                  resultUri += path;
              }
          } else if (!resultUri.endsWith("/")) {
              resultUri += "/";
          }
  
          return resultUri;
      }