Class OperationRequestFactory
java.lang.Object
org.springframework.restdocs.operation.OperationRequestFactory
A factory for creating
OperationRequests
.- Author:
- Andy Wilkinson
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreate
(URI uri, org.springframework.http.HttpMethod method, byte[] content, org.springframework.http.HttpHeaders headers, Collection<OperationRequestPart> parts) Creates a newOperationRequest
.create
(URI uri, org.springframework.http.HttpMethod method, byte[] content, org.springframework.http.HttpHeaders headers, Collection<OperationRequestPart> parts, Collection<RequestCookie> cookies) Creates a newOperationRequest
.createFrom
(OperationRequest original, byte[] newContent) Creates a newOperationRequest
based on the givenoriginal
but with the givennewContent
.createFrom
(OperationRequest original, org.springframework.http.HttpHeaders newHeaders) Creates a newOperationRequest
based on the givenoriginal
but with the givennewHeaders
.
-
Constructor Details
-
OperationRequestFactory
public OperationRequestFactory()
-
-
Method Details
-
create
public OperationRequest create(URI uri, org.springframework.http.HttpMethod method, byte[] content, org.springframework.http.HttpHeaders headers, Collection<OperationRequestPart> parts, Collection<RequestCookie> cookies) Creates a newOperationRequest
. The givenheaders
will be augmented to ensure that they always include aContent-Length
header if the request has any content and aHost
header.- Parameters:
uri
- the request's urimethod
- the request methodcontent
- the content of the requestheaders
- the request's headersparts
- the request's partscookies
- the request's cookies- Returns:
- the
OperationRequest
- Since:
- 3.0.0
-
create
public OperationRequest create(URI uri, org.springframework.http.HttpMethod method, byte[] content, org.springframework.http.HttpHeaders headers, Collection<OperationRequestPart> parts) Creates a newOperationRequest
. The givenheaders
will be augmented to ensure that they always include aContent-Length
header if the request has any content and aHost
header.- Parameters:
uri
- the request's urimethod
- the request methodcontent
- the content of the requestheaders
- the request's headersparts
- the request's parts- Returns:
- the
OperationRequest
- Since:
- 3.0.0
-
createFrom
Creates a newOperationRequest
based on the givenoriginal
but with the givennewContent
. If the original request had aContent-Length
header it will be modified to match the length of the new content.- Parameters:
original
- the original requestnewContent
- the new content- Returns:
- the new request with the new content
-
createFrom
public OperationRequest createFrom(OperationRequest original, org.springframework.http.HttpHeaders newHeaders) Creates a newOperationRequest
based on the givenoriginal
but with the givennewHeaders
.- Parameters:
original
- the original requestnewHeaders
- the new headers- Returns:
- the new request with the new headers
-