Description
UriTemplate.expand should not escape reserved characters in values for reserved expansion (e.g., templates of the form "{+var}").
According to section of 3.2.3 Reserved Expansion: {+var}, reserved character should not be escaped.
Level 2 templates add the plus ("+") operator, for expansion of values that are allowed to include reserved URI characters (Section 1.5).
Example code:
@Test
public void testExpandTemplates_reservedExpansion_shouldNotEscapeReservedCharSet() {
var genDelims = ":/?#[]@";
var subDelims = "!$&'()*+,;=";
var reservedSet = genDelims+subDelims;
var requestMap = Map.of("var", reservedSet);
assertThat(UriTemplate.expand("{+var}", requestMap, false), is(reservedSet));
// Expected: is ":/?#[]@!$&'()*+,;="
// but: was ":/?%23%5B%5D@!$&'()*+,;="
}