'Microprofile RestClient does not read POST response body when 500 error on consuming a service

I am working on a service that makes use of a RestClient to send some data over to a consumed service. Now, the implementation of the latter returns a 500 error message with an entity such as:

{
  status: "ko",
  message: "this error ... bla"
}

In my code, I indeed get a throwable with a 500 exception message, yet I cannot get the response from which I would need to extract the error message:

myClient.postData(MyData myData)
 .handle((resp, throwable)-> {
    // here resp is 'null' 
    [...]
 });

How can I configure my client to read the entity and populate the response object?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source