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 from a string using the given character set.Set the body from aResource.contentType(MediaType mediaType) Set theContent-Typeheader.cookies(ResponseCookie... cookies) Add one or more cookies.cookies(MultiValueMap<String, ResponseCookie> multiValueMap) Copy all cookies from the givenMultiValueMap.createResponse(ClientHttpRequest request) Create a response for the given request.Add a response header with one or more values.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 from a string using the given character set.- Since:
 - 6.0
 
 - 
body
Set the body as a byte array. - 
body
Set the body from aResource. - 
contentType
Set theContent-Typeheader. - 
location
Set theLocationheader. - 
header
Add a response header with one or more values.- Since:
 - 6.0
 
 - 
headers
Copy all given headers. - 
cookies
Add one or more cookies.- Since:
 - 6.0
 
 - 
cookies
Copy all cookies from the givenMultiValueMap.- Since:
 - 6.0
 
 - 
createResponse
Description copied from interface:ResponseCreatorCreate a response for the given request.- Specified by:
 createResponsein interfaceResponseCreator- Parameters:
 request- the request- Throws:
 IOException
 
 -