Skip to content

Commit 560239a

Browse files
artem-gorshkovOlgaMaciaszek
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 8cc00f0 commit 560239a

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
@@ -118,6 +118,9 @@ static String getUrl(String url) {
118118
if (!url.contains("://")) {
119119
url = "http://" + url;
120120
}
121+
if (url.endsWith("/")) {
122+
url = url.substring(0, url.length() - 1);
123+
}
121124
try {
122125
new URL(url);
123126
}

0 commit comments

Comments
 (0)