Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete '/' at the end of url #1037

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ static String getUrl(String url) {
if (!url.contains("://")) {
url = "http://" + url;
}
if (url.endsWith("/")) {
url = url.substring(0, url.length() - 1);
}
try {
new URL(url);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void forType_allFieldsSetOnBuilder() {
assertFactoryBeanField(builder, "contextId", "TestContext");

// and:
assertFactoryBeanField(builder, "url", "http://Url/");
assertFactoryBeanField(builder, "url", "http://Url");
assertFactoryBeanField(builder, "path", "/Path");
assertFactoryBeanField(builder, "dismiss404", true);

Expand All @@ -148,7 +148,7 @@ void forType_clientFactoryBeanProvided() {
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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ private String testGetName(String name) {
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)
Expand Down