Package org.apache.juneau.rest.mock
Class MockRestResponse
java.lang.Object
org.apache.juneau.rest.client.RestResponse
org.apache.juneau.rest.mock.MockRestResponse
- All Implemented Interfaces:
HttpMessage,HttpResponse
-
Constructor Summary
ConstructorsConstructorDescriptionMockRestResponse(RestClient client, RestRequest request, HttpResponse response, Parser parser) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionCaches the response body so that it can be read as a stream multiple times.consume()Consumes the response body.Methods inherited from class org.apache.juneau.rest.client.RestResponse
addHeader, addHeader, assertCharset, assertContent, assertContent, assertContentMatches, assertHeader, assertStatus, assertStatus, containsHeader, getAllHeaders, getCharacterEncoding, getContent, getContentType, getEntity, getFirstHeader, getHeader, getHeaders, getLastHeader, getLocale, getParams, getPartParserSession, getPartParserSession, getProtocolVersion, getReasonPhrase, getRequest, getStatusCode, getStatusLine, getStringHeader, headerIterator, headerIterator, log, log, removeHeader, removeHeaders, setEntity, setHeader, setHeader, setHeaders, setLocale, setParams, setReasonPhrase, setStatusCode, setStatusLine, setStatusLine, setStatusLine
-
Constructor Details
-
MockRestResponse
public MockRestResponse(RestClient client, RestRequest request, HttpResponse response, Parser parser) Constructor.- Parameters:
client- The RestClient that created this response.request- The REST request.response- The HTTP response. Can benull .parser- The overridden parser passed intoRestRequest.parser(Parser).
-
-
Method Details
-
cacheContent
Description copied from class:RestResponseCaches the response body so that it can be read as a stream multiple times. This is equivalent to calling the following:getContent().cache();
- Overrides:
cacheContentin classRestResponse- Returns:
- The body of the response.
-
consume
Description copied from class:RestResponseConsumes the response body.This is equivalent to closing the input stream.
- Overrides:
consumein classRestResponse- Returns:
- This object.
- Throws:
RestCallException- If one of theRestCallInterceptorsthrew an exception.
-