Closed ghost closed 5 years ago
@dwi-di
What you are experiencing is the desired behavior. Template processing in 10.x
has been modified to adhere to RFC 6570: URI Template. This decision was made because much of the template handling prior was inconsistent. We've discovered that, since making this change, there a number of users who relied on this inconsistent, undocumented behavior, as it appears you have as well.
List
expansion follows the requirements outlined in the 3.2.2. Simple String Expansion: {var}, section of the specification, where each value in the list is expanded and split using a comma (,)
:
{list} red,green,blue
To restore the previous behavior, you will need to add the brackets directly to the template.
ok, thank you for the detailed explanation.
For the following request the resulting request body differs between Feign 9.x and Feign 10.x
For Feign 9 the
list
param is expanded into the body usingAbstractCollection.toString()
which is done here: https://github.com/OpenFeign/feign/blob/9.7.0/core/src/main/java/feign/RequestTemplate.java#L147For Feign 10 instead an
expand()
method from Feign is used to serialize thelist
param: https://github.com/OpenFeign/feign/blob/master/core/src/main/java/feign/template/Template.java#L104As a result in Feign 9 the
list
param is encoded with the surrounding brackets[1,2,3]
but for Feign 10 it is encoded without brackets1,2,3
.Of course it is possible to adjust the @Body annotation and just add the brackets if using Feign 10, but I suppose this change was not intended and the behaviour should be changed?