int-http:出站网关 HttpMessageNotReadableException

int-http:outbound-gateway HttpMessageNotReadableException

我们使用了 int-http:outbound-gateway

<int-http:outbound-gateway request-channel="userDataRequest"
                           id="outboundUserDetailsGateway" url-expression="url"
                           http-method="GET" expected-response-type="com.xxx.UserResponse">
</int-http:outbound-gateway>

我们从出站网关发出的 GET 请求工作正常。我们通过各种休息clients/curl验证了它。

流程概览

用户点击了一些 post 请求(入站请求)。该请求由 int-http:inbound-gateway 检索。为了获取一些详细信息,我们的系统会向其他系统发出上面提到的一个 GET(出站请求)请求。

问题 当入站请求(POST)由 curl/jmeter/Advance 休息客户端完成时,它工作正常,但是,如果该请求来自 postman/boomerang,则它显示

org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Illegal character ((CTRL-CHAR, code 31)): only regular white space (\r, \n, \t) is allowed between tokens at [Source: java.io.PushbackInputStream@3f0a204c; line: 1, column: 2]; nested exception is com.fasterxml.jackson.core.JsonParseException: Illegal character ((CTRL-CHAR, code 31)): only regular white space (\r, \n, \t) is allowed between tokens at [Source: java.io.PushbackInputStream@3f0a204c; line: 1, column: 2]

系统遇到出站请求 (GET) 请求时出现此错误。

在我们的例子中,我们在服务端 Nginx 的 gzip 中包含 application/json。我们刚刚从 gzip 中排除了 application/json,它对我们有用。