我有一个Feign客户,可以从External Api得到答复。 下面是Feign Client的代码
@FeignClient(name = "demo", url = "http://localhost:8080")
public interface DemoClient {
@RequestMapping(method = RequestMethod.POST, value = "/api/", consumes = "application/json")
public Response getPayANorLOS(@RequestHeader("AUTH_TOKEN") String token, @RequestBody MyRequest reqBodyProp);
}
我正在使用下面的代码来使用它
try{
Response response =DemoClient.getPayANorLOS(headerProp, reqBodyProp);
}catch (Exception e) {
//we need to log the error
log.error("Unable to get", e.getMessage());
subscriber.onError(e);
}
我总是例外。我也记录了请求,看到了响应
---> POST http://localhost:8080/api/ HTTP/1.1
Content-Type: application/json
AUTH_TOKEN: SBAWCS01:ElHfgB9ESd8Du8pIYKHxxPOWkT26GLf4zhmRVk
Content-Length: 365
---> END HTTP (365-byte body)
<--- HTTP/1.1 200 OK (547ms)
connection: close
content-length: 232
content-security-policy: default-src 'self' https; script-src https: 'self'
'unsafe-inline'; connect-src https: 'self'
content-type: application/json
date: Thu, 16 Aug 2018 19:17:08 GMT
server: Apache-Coyote/1.1
strict-transport-security: max-age=31536000; includeSubDomains
vary: Accept-Encoding
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
{"validThru":"11/22","type":"Demo","brand":"TIM"}
<--- END HTTP (232-byte body)
为什么我总是出现异常。请帮忙。 另外,该异常为null。