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
This commit is contained in:
Artem Gorshkov
2022-04-28 12:36:53 +03:00
committed by Olga Maciaszek-Sharma
parent 8cc00f0060
commit 560239a92b

View File

@@ -118,6 +118,9 @@ class FeignClientsRegistrar implements ImportBeanDefinitionRegistrar, ResourceLo
if (!url.contains("://")) {
url = "http://" + url;
}
if (url.endsWith("/")) {
url = url.substring(0, url.length() - 1);
}
try {
new URL(url);
}