3

I am trying to retrieve an online image content in a Spring Boot application by using the below Feign client.

@FeignClient(name = "image")
public interface ImageClient {

    @RequestMapping(method = RequestMethod.GET)
    byte[] getContent(URI uri) throws WebException;

}

The issue that I have is that when I call the getContent method with an URL such as https://images.foo.com/1234567/5c5a7f14-d5d4-4a79-9c2e-78fed8b738c5.jpeg?foo=123, the HTTP call is made to https://images.foo.com/1234567/5c5a7f14-d5d4-4a79-9c2e-78fed8b738c5.jpeg/?foo=123 and I get an error from the server.

Is there any way to prevent Feign from adding a slash before the query parameters ?

adrum
  • 53
  • 1
  • 4

2 Answers2

1

to avoid that divide the URL

@FeignClient(name = "image" ,value url = "BASE")
public interface ImageClient {

    @RequestMapping(method = RequestMethod.GET ,value  = "X" )
    byte[] getContent(URI uri) throws WebException;

}

final is B/X no trailing / added

Denis Sablukov
  • 3,360
  • 2
  • 26
  • 31
Rolo
  • 11
  • 1
0

You can also

@FeignClient(name = "image" ,  url = "BASE") 
public interface ImageClient {

@RequestMapping(method = RequestMethod.GET   )
byte[] getContent(URI uri) throws WebException;

}
Denis Sablukov
  • 3,360
  • 2
  • 26
  • 31
Rolo
  • 11
  • 1