#1696 - Re-instantiate conversion for request parameter template variables.

When adding a request parameter template variable and the URI part of the template already contains a request parameter we now automatically turn the variable type into request parameter continuation. That apparently got lost in the move to level 4 URI templates in #1583.
This commit is contained in:
Oliver Drotbohm
2021-10-28 20:42:55 +02:00
parent 2cac83fcef
commit 07125638f4
2 changed files with 17 additions and 1 deletions

View File

@@ -366,6 +366,15 @@ class UriTemplateUnitTest {
assertThat(uri).isEqualTo(URI.create("/foo/first/second"));
}
@Test // #1696
void adaptsRequestParamVariableToContinuationIfBaseUriContainsParameter() {
UriTemplate template = UriTemplate.of("/path/{bar}/foo.zip?type=foo")
.with(new TemplateVariable("foobar", VariableType.REQUEST_PARAM));
assertThat(template.toString()).isEqualTo("/path/{bar}/foo.zip?type=foo{&foobar}");
}
private static void assertVariables(UriTemplate template, TemplateVariable... variables) {
assertVariables(template, Arrays.asList(variables));
}