public < T > T getResponseBody ( Class < T > clazz ) { final ByteBuf byteBuf = httpInputMessage . getBody ( ) ; if ( byteBuf . readableBytes ( ) == 0 || Void . class . isAssignableFrom ( clazz ) ) return null ; final MediaType mediaType = MediaType . parseMediaType ( httpInputMessage . getHeaders ( ) . get ( HttpHeaders . CONTENT_TYPE ) ) ; for ( HttpMessageConverter httpMessageConverter : httpMessageConverters ) { if ( httpMessageConverter . canRead ( clazz , mediaType ) ) { return ( T ) httpMessageConverter . read ( clazz , httpInputMessage ) ; } } return null ; }
Return the response body converted to the given class