HttpBuilder失败后失去身体

时间:2017-03-17 03:05:39

标签: httpbuilder-ng

我正在使用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;
});

0 个答案:

没有答案