@Test public void content() throws IOException { byte[] bytes = "body".getBytes(Charset.defaultCharset()); request.setContent(bytes); assertEquals(bytes.length, request.getContentLength()); assertNotNull(request.getInputStream()); assertEquals( "body", StreamUtils.copyToString(request.getInputStream(), Charset.defaultCharset())); }
@Test public void noContent() throws IOException { assertEquals(-1, request.getContentLength()); assertNotNull(request.getInputStream()); assertEquals(-1, request.getInputStream().read()); }