@Override public LazyBodyReader toBodyReader() { return new LazyBodyReader( new FramedBody.ContentLength(getBodyDecoder(), (long) bytes.length), new ByteArrayInputStream(bytes)); }
@Test public void replacingBodyWithBytes() throws IOException { byte[] bytes = "Hello RawHTTP".getBytes(); RawHttp http = new RawHttp(); RawHttpRequest request = http.parseRequest("POST http://example.com/hello"); RawHttpRequest requestWithBody = request.withBody( new BytesBody(bytes, "text/plain")); System.out.println(requestWithBody.eagerly()); }
@Override public LazyBodyReader toBodyReader() { return new LazyBodyReader( new FramedBody.ContentLength(getBodyDecoder(), (long) bytes.length), new ByteArrayInputStream(bytes)); }