@FeignClient(name = "sample-service")
public interface SampleFeignClient {
@RequestMapping(method = RequestMethod.GET, value = "/sample-service/sample",
produces = "application/xml",
consumes = "text/xml")
String getSample();
}
I see that on Http Request the headers are as follows:
This seems counterintuitive to me, I'd expect the following:
Thoughts...?
Another reason I should have never added the Spring MVC annotations to feign :-) They map to the same headers as the server. It means the server 'consumes' text/html, so the client creates the Content-Type header. People share interfaces between client and server. I don't think this will change.
I see the motivation :) however sharing interfaces between client and server does not seem like a great idea especially when using consumes and produces attributes.
Also Http headers on Server have a completely different meaning:
@RequestMapping(value = "/sample-service/sample",
produces = "text/xml",
consumes = "application/xml"
)
public ResponseEntity<String> sample() {
return ResponseEntity.ok("sample response");
}
Below is a little visual that sums up our conversation - on my original expectation when I started looking at spring-feign and how it actually turned out to be :)
Expected (intuitive)

Existing (not so intuitive)

Anyways thank you Spencer for quick response! I understand the motivation and something we need to keep in mind as we use spring-feign.
Closing due to age of the question. If you would like us to look at this issue, please comment and we will look at re-opening the issue.