How to get the responseBody of a FeignException

1.9k Views Asked by At

I'm trying to get response body out of an FeignException and the responseBody is there as ByteBuffer. within the byte buffer there is a heapBuffer which has the content I want. but I can't access it.

catch (FeignException ex){
            if(ex.responseBody().isPresent()){
                ByteBuffer byteBuffer = ex.responseBody().get();
            }
            }

but when evaluate the following with the debugger mode in Intellij I can get the content I want. but I can't introduce it to my code.

new String(ex.responseBody().get().hb)

here 'hb' is reffered to heap buffer in ByteBuffer.

Can someone help me to get the content in the responseBody?

The respose contains a xml content which is to mapped to response object.

0

There are 0 best solutions below