Class OperationResponseFactory
java.lang.Object
org.springframework.restdocs.operation.OperationResponseFactory
A factory for creating
OperationResponses
.- Author:
- Andy Wilkinson
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreate
(int status, org.springframework.http.HttpHeaders headers, byte[] content) Creates a newOperationResponse
.createFrom
(OperationResponse original, byte[] newContent) Creates a newOperationResponse
based on the givenoriginal
but with the givennewContent
.createFrom
(OperationResponse original, org.springframework.http.HttpHeaders newHeaders) Creates a newOperationResponse
based on the givenoriginal
but with the givennewHeaders
.
-
Constructor Details
-
OperationResponseFactory
public OperationResponseFactory()
-
-
Method Details
-
create
public OperationResponse create(int status, org.springframework.http.HttpHeaders headers, byte[] content) Creates a newOperationResponse
. If the response has any content, the givenheaders
will be augmented to ensure that they include aContent-Length
header.- Parameters:
status
- the status of the responseheaders
- the response's headerscontent
- the content of the response- Returns:
- the
OperationResponse
-
createFrom
Creates a newOperationResponse
based on the givenoriginal
but with the givennewContent
. If the original response had aContent-Length
header it will be modified to match the length of the new content.- Parameters:
original
- the original responsenewContent
- the new content- Returns:
- the new response with the new content
-
createFrom
public OperationResponse createFrom(OperationResponse original, org.springframework.http.HttpHeaders newHeaders) Creates a newOperationResponse
based on the givenoriginal
but with the givennewHeaders
.- Parameters:
original
- the original responsenewHeaders
- the new headers- Returns:
- the new response with the new headers
-