服务器使用request.getInputStream()
获取请求正文。
客户端代码:
@FeignClient(name="composer-agent")
public interface ComposerClient {
@RequestMapping(value = "/agent/import_bp", method = RequestMethod.POST)
String importBlueprints(String payload);
}
但我得到一个例外:
Caused by: feign.FeignException: status 500 reading ComposerClient#importBlueprints(String); content:
{"timestamp":"2017-10-19T06:15:47-0400","status":500,"error":"Internal Server Error","exception":"java.lang.IllegalArgumentException","message":"MIME type may not contain reserved characters"}
at feign.FeignException.errorStatus(FeignException.java:62)
at feign.codec.ErrorDecoder$Default.decode(ErrorDecoder.java:91)
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:138)
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76)
at feign.hystrix.HystrixInvocationHandler$1.run(HystrixInvocationHandler.java:108)
at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:301)
at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:297)
at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)
... 144 common frames omitted
此外,我尝试设置consumes = MediaType.APPLICATION_JSON_VALUE
或其他值,或添加@RequestBody
,但我得到相同的例外。
那么我该怎么处理这个问题呢?感谢。
答案 0 :(得分:0)
当底层HTTP客户端是Apache HTTP客户端时,这是Feign 9.3.0中的known bug。解决方案是升级feign-httpclient
依赖项。例如:
compile "io.github.openfeign:feign-httpclient:9.5.0"