Describe the bug
If we add add a header named abc with value {x:1.0,y:1.1} to OpenFeign RestTemplate, and get it to print, the final value will be {x:1.0,y}. That means :1.1 is lost.
This issue happens on Spring Cloud 2021.0.4.0, Spring Cloud 2020.0.6 and Hoxton.SR12 works fine.
Please take a look for it. Thanks
Sample
RequestInterceptor code as follows
import feign.RequestInterceptor;
import feign.RequestTemplate;
public class MyRequestInterceptor implements RequestInterceptor {
@Override
public void apply(RequestTemplate requestTemplate) {
String headerName = "abc";
String headerValue = "{x:1.0,y:1.1}";
System.out.println("--- Before adding: " + headerName + " = " + headerValue);
requestTemplate.header(headerName, headerValue);
String headerValueInRequestTemplate = requestTemplate.headers().get(headerName).toString();
System.out.println("=== Get value after Adding: " + headerName + " = " + headerValueInRequestTemplate);
}
}
Create the bean in your configuration
@Bean
public MyRequestInterceptor myRequestInterceptor() {
return new MyRequestInterceptor();
}
Describe the bug
If we add add a header named
abcwith value{x:1.0,y:1.1}to OpenFeignRestTemplate, and get it to print, the final value will be{x:1.0,y}. That means:1.1is lost.This issue happens on Spring Cloud
2021.0.4.0, Spring Cloud2020.0.6andHoxton.SR12works fine.Please take a look for it. Thanks
Sample
RequestInterceptorcode as followsCreate the bean in your configuration