所以我有一个假客户,如下:
@FeignClient(name = "ServiceClient", url = "${base.url}", configuration = FeignClientConfig.class)
public interface ServiceClient {
@RequestMapping(method = RequestMethod.GET, value = "/api/v1/failed", consumes = MediaType.APPLICATION_JSON_VALUE)
List<Info> getData();
}
错误:
"Error message: Could not extract response: no suitable HttpMessageConverter found for response type [java.util.List<com.example.Info>] and content type [application/octet-stream]"
所以我使用 dockerwiremock 服务器运行此服务,在邮递员中进行测试,它给了我一个有效的 json 字符串值。
有什么想法为什么会发生这种情况吗?
在映射中缺少以下内容:
"headers": {
"Content-Type": "application/json"
},