feign
feign copied to clipboard
URL encoding includes parameter names such as "$skip"
Hi All,
I have the folloging feign client:
@FeignClient(name = "MdsDataClient", url = "${integration.mds.host.url}", decode404 = true)
public interface MdsClient {
@GetMapping(value = "{path}")
Response get(
@PathVariable("path") String path,
@SpringQueryMap(encoded = true) Map<String, String> params,
@RequestHeader Map<String, String> headerMap);
}
One of the defined parameters of the provided service is called "$skip".
Instead of GET https://services.com/currency/api/v2?rateType=DQ&from=USD&to=EUR&dateFrom=2012-01-01&dateTo=2012-01-01&$top=1&$skip=0
, I end up with the following URI https://services.com/currency/api/v2?rateType=DQ&from=USD&to=EUR&dateFrom=2012-01-01&dateTo=2012-01-01&%24top=1&%24skip=0
I also tried the encoded = true
setting on the @SpringQueryMap, but that seems to be take only the values and not the keys into account.
Any insights? A bug? By design? Thanks.
The resulting URL is correct. %24
is just $
as pct-encoded per the URI template specification. https://datatracker.ietf.org/doc/html/rfc6570. $
is a reserved character in the URI specification and should be percent encoded: https://datatracker.ietf.org/doc/html/rfc3986
@berndgoetz @kdavisk6 i have same issue on OData query option like $filter, any solution or workaround by far? thanks
There's no workaround needed. The resulting URI is correct, just encoded.