Permalink
Browse files

Copy the buffer when returning an input stream.

This way the body can be consumed many times.
  • Loading branch information...
1 parent f8f04a0 commit 4921308c661b35342e4f2da82402a0095befa483 @dkowis dkowis committed Nov 20, 2013
View
3 betamax-proxy/src/main/java/co/freeside/betamax/proxy/netty/NettyMessageAdapter.java
@@ -81,6 +81,7 @@ public boolean hasBody() {
@Override
protected InputStream getBodyAsStream() throws IOException {
- return new ByteBufInputStream(body);
+ //Copy the body into a new ByteBuf so that it can be consumed multiple times.
+ return new ByteBufInputStream(Unpooled.copiedBuffer(body));
}
}

0 comments on commit 4921308

Please sign in to comment.