Class DefaultResponseCreator
java.lang.Object
org.springframework.test.web.client.response.DefaultResponseCreator
- All Implemented Interfaces:
ResponseCreator
A
ResponseCreator with builder-style methods for adding response details.- Since:
- 3.2
- Author:
- Rossen Stoyanchev
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefaultResponseCreator(int statusCode) Protected constructor.protectedDefaultResponseCreator(HttpStatusCode statusCode) Protected constructor. -
Method Summary
Modifier and TypeMethodDescriptionbody(byte[] content) Set the body as a byte array.Set the body as a UTF-8 String.Set the body as aResource.contentType(MediaType mediaType) Set theContent-Typeheader.createResponse(ClientHttpRequest request) Create a response for the given request.headers(HttpHeaders headers) Copy all given headers.Set theLocationheader.
-
Constructor Details
-
DefaultResponseCreator
protected DefaultResponseCreator(int statusCode) Protected constructor. Use static factory methods inMockRestResponseCreators.- Since:
- 5.3.17
-
DefaultResponseCreator
Protected constructor. Use static factory methods inMockRestResponseCreators.
-
-
Method Details
-
body
Set the body as a UTF-8 String. -
body
Set the body as a byte array. -
body
Set the body as aResource. -
contentType
Set theContent-Typeheader. -
location
Set theLocationheader. -
headers
Copy all given headers. -
createResponse
Description copied from interface:ResponseCreatorCreate a response for the given request.- Specified by:
createResponsein interfaceResponseCreator- Parameters:
request- the request- Throws:
IOException
-