private String appendRequestPath ( String uri , Map < String , Object > headers ) { if ( ! headers . containsKey ( REQUEST_PATH_HEADER_NAME ) ) { return uri ; } String requestUri = uri ; String path = headers . get ( REQUEST_PATH_HEADER_NAME ) . toString ( ) ; while ( requestUri . endsWith ( "/" ) ) { requestUri = requestUri . substring ( 0 , requestUri . length ( ) - 1 ) ; } while ( path . startsWith ( "/" ) && path . length ( ) > 0 ) { path = path . length ( ) == 1 ? "" : path . substring ( 1 ) ; } return requestUri + "/" + path ; }
Appends optional request path to endpoint uri .