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, Parameters parameters, Collection<OperationRequestPart> parts) Creates a newOperationRequest
.create
(URI uri, org.springframework.http.HttpMethod method, byte[] content, org.springframework.http.HttpHeaders headers, Parameters parameters, 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
.createFrom
(OperationRequest original, Parameters newParameters) Creates a newOperationRequest
based on the givenoriginal
but with the givennewParameters
applied.
-
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, Parameters parameters, 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 headersparameters
- the request's parametersparts
- the request's partscookies
- the request's cookies- Returns:
- the
OperationRequest
-
create
public OperationRequest create(URI uri, org.springframework.http.HttpMethod method, byte[] content, org.springframework.http.HttpHeaders headers, Parameters parameters, 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 headersparameters
- the request's parametersparts
- the request's parts- Returns:
- the
OperationRequest
-
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
-
createFrom
Creates a newOperationRequest
based on the givenoriginal
but with the givennewParameters
applied. The query string of aGET
request will be updated to reflect the new parameters.- Parameters:
original
- the original requestnewParameters
- the new parameters- Returns:
- the new request with the parameters applied
-