spring feign 请求给出错误,没有合适的转换器

问题描述 投票:0回答:1

所以我有一个假客户,如下:

@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 字符串值。

有什么想法为什么会发生这种情况吗?

spring-boot wiremock
1个回答
0
投票

在映射中缺少以下内容:

"headers": {
  "Content-Type": "application/json"  
},
© www.soinside.com 2019 - 2024. All rights reserved.