springfeignrequest-mapping

Feign call URL with comma


I'm trying to call a URL with commas, curly braces and square brackets in it.

With Feign, here is how I begin :

@FeignClient(name="FinancialTimesFeignClient", url="https://markets.ft.com/data/equities/ajax/updateScreenerResults")
public interface FinancialTimesClient {
    @GetMapping(value="?data=[a,b]")
    FinancialTimesDto getTickers();
}

The problem is that the url should end with data=[a,b] but I get this:

GET /data/equities/ajax/updateScreenerResults?data=[a&data=b]

It won't be understood by the server. Can I disable the rewriting?


Solution

  • You can pass the value of data as a String RequestParam to your method getTickers so that it will be append to the URL :

    ...
     @GetMapping
     FinancialTimesDto getTickers(@RequestParam String data);
    ...