0

I am using HttpBuilder-NG. On error I am getting following response from server.

{ "error": "JsonError", "param": { "obj.instructorId": [ { "msg": "Instructor Not Found", "args": [] } ] } }

But HttpBuilder is losing body. The fromServer object is coming as....

   fromServer = {JavaHttpBuilder$Action$JavaFromServer@3109} 
   is = null
   hasBody = false
   headers = {Collections$UnmodifiableRandomAccessList@3113}  size = 10
   uri = "**********"
   this$1 = {JavaHttpBuilder$Action@3092} 

Code for the error handling is

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;
});
cjstehno
  • 13,468
  • 4
  • 44
  • 56
Arun
  • 31
  • 3
  • I am not clear about what you mean. Are you saying that the request or response body is lost? Is that JSON the actual response or the expected response? Is there any way you can create a standalone example of this so that I can try it locally? (I am one of the developers on the HttpBuilder-NG project) – cjstehno Mar 24 '17 at 12:29
  • This sounds a bit like an issue that was just fixed: https://github.com/http-builder-ng/http-builder-ng/issues/93 in our codebase – cjstehno Mar 27 '17 at 12:05

0 Answers0