服務器使用request.getInputStream()
獲取請求正文。如何使用FeignClient發佈字符串
客戶端代碼:
@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
,但我得到了同樣的異常。
那麼我該如何處理這個問題呢?謝謝。
' 「狀態」:500, 「錯誤」: 「內部服務器錯誤」, 「異常」: 「java.lang.IllegalArgumentException異常」, 「消息」:「MIME類型可能不包含保留字符「'。你的mimetype似乎包含非法字符。所以問題是:你正在使用哪種mimetype(它在代碼中沒有顯示)? –