private static Request consume ( final Request req ) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; new RqPrint ( req ) . printBody ( baos ) ; return new Request ( ) { @ Override public Iterable < String > head ( ) throws IOException { return req . head ( ) ; } @ Override public InputStream body ( ) { return new ByteArrayInputStream ( baos . toByteArray ( ) ) ; } } ; }
Consume the request .