I am writing a feign client to consume an endpoint of a PHP API.
I need to call an endpoint which is like :
www.myapp.com/number.php?number[]=1
My Feign Client looks like this:
@FeignClient(name = "testProxy", url = "${service.url}")
public interface NumberProxy {
@RequestMapping(value = INumber.URL, method = RequestMethod.GET)
public String getEvents(@RequestParam("numbers[]") Integer number);
}
The problems is number[].
If I see the feign log to check the GET URL, this is what I see.
GET [https://www.myapp.com/number.php?number[]={number[]}][1] HTTP/1.1
The number[] is not replaced by the actual value and that is what the API call is failing.
Is there a way to deal with this?
P.S. I know that the PHP API should not have a query parameter like this, but it is what it is and I can not change that.
And I have also tried with List<Integer> for the number variable, but output is same.
Are we talking about a
org.springframework.web.bind.annotation.RequestParamif so it shouldn't be the problem of square brackets. For me it works fine:logs a value passed through a client
What if the problem is in parameter naming? In the first occurence you write numberS[] but further it named as number[]