Class OperationResponseFactory
java.lang.Object
org.springframework.restdocs.operation.OperationResponseFactory
A factory for creating
OperationResponses.- Author:
- Andy Wilkinson, Clyde Stubbs
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate(org.springframework.http.HttpStatusCode status, org.springframework.http.HttpHeaders headers, byte @Nullable [] content) Creates a newOperationResponsewithout cookies.create(org.springframework.http.HttpStatusCode status, org.springframework.http.HttpHeaders headers, byte @Nullable [] content, Collection<ResponseCookie> cookies) Creates a newOperationResponse.createFrom(OperationResponse original, byte[] newContent) Creates a newOperationResponsebased on the givenoriginalbut with the givennewContent.createFrom(OperationResponse original, org.springframework.http.HttpHeaders newHeaders) Creates a newOperationResponsebased on the givenoriginalbut with the givennewHeaders.
-
Constructor Details
-
OperationResponseFactory
public OperationResponseFactory()
-
-
Method Details
-
create
public OperationResponse create(org.springframework.http.HttpStatusCode status, org.springframework.http.HttpHeaders headers, byte @Nullable [] content) Creates a newOperationResponsewithout cookies. If the response has any content, the givenheaderswill be augmented to ensure that they include aContent-Lengthheader.- Parameters:
status- the status of the responseheaders- the request's headerscontent- the content of the request- Returns:
- the
OperationResponse - Since:
- 3.0.0
-
create
public OperationResponse create(org.springframework.http.HttpStatusCode status, org.springframework.http.HttpHeaders headers, byte @Nullable [] content, Collection<ResponseCookie> cookies) Creates a newOperationResponse. If the response has any content, the givenheaderswill be augmented to ensure that they include aContent-Lengthheader.- Parameters:
status- the status of the responseheaders- the request's headerscontent- the content of the requestcookies- the cookies- Returns:
- the
OperationResponse - Since:
- 3.0.0
-
createFrom
Creates a newOperationResponsebased on the givenoriginalbut with the givennewContent. If the original response had aContent-Lengthheader 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 newOperationResponsebased on the givenoriginalbut with the givennewHeaders.- Parameters:
original- the original responsenewHeaders- the new headers- Returns:
- the new response with the new headers
-