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

Avoided url appending with slash when matrix parameter exists #999

Merged
merged 2 commits into from
Jul 18, 2019
Merged
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
2 changes: 1 addition & 1 deletion core/src/main/java/feign/RequestTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ public RequestTemplate uri(String uri, boolean append) {
if (uri == null) {
uri = "/";
} else if ((!uri.isEmpty() && !uri.startsWith("/") && !uri.startsWith("{")
&& !uri.startsWith("?"))) {
&& !uri.startsWith("?") && !uri.startsWith(";"))) {
/* if the start of the url is a literal, it must begin with a slash. */
uri = "/" + uri;
}
Expand Down
9 changes: 9 additions & 0 deletions core/src/test/java/feign/RequestTemplateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -469,4 +469,13 @@ public void fragmentShouldNotBeEncodedInTarget() {

assertThat(template.url()).isEqualTo("https://example.com/path?key1=value1#fragment");
}

@Test
public void slashShouldNotBeAppendedForMatrixParams(){
RequestTemplate template = new RequestTemplate().method(HttpMethod.GET)
.uri("/path;key1=value1;key2=value2",true);

assertThat(template.url()).isEqualTo("/path;key1=value1;key2=value2");

}
}