I'm using feign in spring-cloud, I have got a problem.
This is my feign client def.
@FeignClient("food-service")
public interface FoodService {
@RequestMapping(value = {"/food"},method = {RequestMethod.GET})
List<Food> find(@RequestParam("name") String name);
}
foodService.find("{co%%");
this call will be returned status code 400 .
Then I review the code, and I found this code in RequestTemplate class :
private String encodeIfNotVariable(String in) {
if (in == null || in.indexOf('{') == 0) {
return in;
}
return urlEncode(in);
}
The method encodeIfNotVariable
called in query(String name, String... values) .
This means if the value containing {
and in the first , the value cannot to be encode.
How can I fix this?