1

I have a trouble with spring-cloud-openfeign-core after update from version 2.1.1 to version 2.1.2.

When I perform a call with an empty parameter it always adds its name to a query string that was not the case before. The generated url in 2.1.1 is http://test.url/endpoint but in 2.1.2 it becomes http://test.url/endpoint?id with ?id at the end.

// request
myFeignClient.myGetRequest(List.of())

// client
@FeignClient(name = "client", url = "http://test.url/")
public interface MyFeignClient {

    @RequestLine("GET /endpoint?id={id}")
    Object get(@Param(value = "id") List<String> id);
}

Is there any way to get rid of empty parameters names?

Vitalii
  • 10,091
  • 18
  • 83
  • 151

1 Answers1

-1

I wouldn't expect this to work. Have a look at this

And you should try this in client feign:

@GetMapping("/endpoint")
@ResponseBody
Object get(@RequestParam(value = "id", required = false) List<String> id);

Server :

@GetMapping("/endpoint")
Object get(@RequestParam(value = "id", required = false) List<String> id) {
     //...
}
sovannarith cheav
  • 743
  • 1
  • 6
  • 19