我正在使用HttpBuilder-NG。出错时我收到服务器的响应。
{
"error": "JsonError",
"param": {
"obj.instructorId": [
{
"msg": "Instructor Not Found",
"args": []
}
]
}
}
但是HttpBuilder正在失去身体。 fromServer对象即将......
fromServer = {JavaHttpBuilder$Action$JavaFromServer@3109}
is = null
hasBody = false
headers = {Collections$UnmodifiableRandomAccessList@3113} size = 10
uri = "**********"
this$1 = {JavaHttpBuilder$Action@3092}
错误处理的代码是
config.getRequest().getHeaders().put("Authorization","Bearer " + AccessToken);
config.getRequest().getUri().setPath(path);
config.getRequest().setBody(paramValues);
config.getResponse().when(400,(fromServer, o) -> {
LazyMap lazyMap = new LazyMap();
lazyMap.put("error", fromServer.getMessage());
return lazyMap;
});