使用@RequestLine 时设置媒体类型

Setting the media type when using @RequestLine

我在我的 Feign Client 界面中使用 @RequestLine annotatin。它只需要请求方法和路径,有没有办法设置它生产和消费的媒体类型?

这就是我所拥有的,有什么建议可以添加它生成和使用的媒体类型吗?

@RequestLine("POST /metrics-service/rest/addMetric")
    MyEntity sendEntity(@RequestBody MyEntity toSend);

是的,很简单,你可以添加

@Headers("Content-Type: application/json")

查看参考资料:https://github.com/Netflix/feign