in src/main/java/org/apache/sling/commons/testing/integration/HttpTestBase.java [560:573]
public static String getResponseBodyAsStream(HttpMethodBase m, int maxLength) throws IOException {
final InputStream is = m.getResponseBodyAsStream();
final StringBuilder content = new StringBuilder();
final String charset = m.getResponseCharSet();
final byte [] buffer = new byte[16384];
int n = 0;
while( (n = is.read(buffer, 0, buffer.length)) > 0) {
content.append(new String(buffer, 0, n, charset));
if(maxLength != 0 && content.length() > maxLength) {
throw new IllegalArgumentException("Response body size is over maxLength (" + maxLength + ")");
}
}
return content.toString();
}