Skip to content

Commit 3b1d272

Browse files
artem-gorshkovbirariro
authored andcommitted
Delete '/' at the end of url
In situation when we create FeignClient in this way: @FeignClient(url = "https://localhost/", path = "api/v2") We will get an error because of adding '/' in the beginning of the path in FeignClientsRegistrar.getPath, result will: https://localhost//api/v2 To escape this situation we need to delete '/' at the end of url in FeignClientsRegistrar.getUrl
1 parent e067fdf commit 3b1d272

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

spring-cloud-openfeign-core/src/main/java/org/springframework/cloud/openfeign/FeignClientsRegistrar.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ static String getUrl(String url) {
117117
if (!url.contains("://")) {
118118
url = "http://" + url;
119119
}
120+
if (url.endsWith("/")) {
121+
url = url.substring(0, url.length() - 1);
122+
}
120123
try {
121124
new URL(url);
122125
}

0 commit comments

Comments
 (0)