fix: remove last slash of url
This commit is contained in:
committed by
Olga Maciaszek-Sharma
parent
b56dc8dbf4
commit
f9e55b5d8a
@@ -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);
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ class FeignClientBuilderTests {
|
||||
assertFactoryBeanField(builder, "contextId", "TestContext");
|
||||
|
||||
// and:
|
||||
assertFactoryBeanField(builder, "url", "http://Url/");
|
||||
assertFactoryBeanField(builder, "url", "http://Url");
|
||||
assertFactoryBeanField(builder, "path", "/Path");
|
||||
assertFactoryBeanField(builder, "dismiss404", true);
|
||||
|
||||
@@ -155,7 +155,7 @@ class FeignClientBuilderTests {
|
||||
assertFactoryBeanField(builder, "contextId", "TestContext");
|
||||
|
||||
// and:
|
||||
assertFactoryBeanField(builder, "url", "http://Url/");
|
||||
assertFactoryBeanField(builder, "url", "http://Url");
|
||||
assertFactoryBeanField(builder, "path", "/Path");
|
||||
assertFactoryBeanField(builder, "dismiss404", true);
|
||||
List<FeignBuilderCustomizer> additionalCustomizers = getFactoryBeanField(builder, "additionalCustomizers");
|
||||
|
||||
@@ -89,6 +89,12 @@ class FeignClientsRegistrarTests {
|
||||
return registrar.getName(Collections.singletonMap("name", name));
|
||||
}
|
||||
|
||||
@Test
|
||||
void removeLastSlashOfUrl() {
|
||||
String url = FeignClientsRegistrar.getUrl("http://localhost/");
|
||||
assertThat(url).isEqualTo("http://localhost");
|
||||
}
|
||||
|
||||
@Test
|
||||
void testFallback() {
|
||||
assertThatExceptionOfType(IllegalArgumentException.class)
|
||||
|
||||
Reference in New Issue
Block a user