如何解决将 MultiValueMap 参数作为 http 链接键值值发送
我有这个带有参数的 MultiValueMap,我想将其作为 http 链接键值值发送
MultiValueMap<String,String> map = new LinkedMultiValueMap<>();
map.add("entityId","123456");
map.add("amount","123456");
假客户端:
@FeignClient(name = "Staging",url = "https://test.com")
public interface Client {
@RequestMapping(method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_VALUE)
SaleResponse performSaleTransaction(@QueryMap MultiValueMap<String,String> params);
}
但我得到了例外:
feign.FeignException$BadRequest: [400 Bad Request] during [POST] to [https://test.com] [Client#performSaleTransaction(String,MultiValueMap)]: [{"result":{"code":"200.300.404","description":"invalid or missing parameter","parameterErrors":[{"name":"entityId","value":null,"message":"invalid or missing parameter"}]},"buildNumber":"......","timestamp":"2021-05-23 12:31:52+0000","ndc":"......"}]
at feign.FeignException.clientErrorStatus(FeignException.java:195)
看起来 Feign 无法正确转换 MultiValueMap
中的值。你知道我该如何解决这个问题吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。