{8.2.0-new} Response Body
The response body is accessed through the following method:
The {@link oajr.client2.RestResponseBody} class extends from the HttpClient {@link org.apache.http.HttpEntity} class and provides several convenience methods:
The response body can only be consumed once unless it has been cached into memory. In many cases, the body is automatically cached when using the assertions methods or methods such as {@link oajr.client2.RestResponseBody#asString()}. However, methods that involve reading directly from the input stream cannot be called twice. In these cases, the {@link oajr.client2.RestResponse#cacheBody()} and {@link oajr.client2.RestResponseBody#cache()} methods are provided to cache the response body in memory so that you can perform several operations against it.
Assertion methods are also provided for fluent-style calls:
Object assertions allow you to parse the response body into a POJO and then perform various tests on that resulting POJO.