Class OperationRequestFactory
java.lang.Object
org.springframework.restdocs.operation.OperationRequestFactory
A factory for creating
OperationRequests.- Author:
- Andy Wilkinson
-
Constructor Summary
Constructors -
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 newOperationRequestbased on the givenoriginalbut with the givennewContent.createFrom(OperationRequest original, org.springframework.http.HttpHeaders newHeaders) Creates a newOperationRequestbased on the givenoriginalbut with the givennewHeaders.createFrom(OperationRequest original, Parameters newParameters) Creates a newOperationRequestbased on the givenoriginalbut with the givennewParametersapplied.
-
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 givenheaderswill be augmented to ensure that they always include aContent-Lengthheader if the request has any content and aHostheader.- 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 givenheaderswill be augmented to ensure that they always include aContent-Lengthheader if the request has any content and aHostheader.- 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 newOperationRequestbased on the givenoriginalbut with the givennewContent. If the original request had aContent-Lengthheader 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 newOperationRequestbased on the givenoriginalbut with the givennewHeaders.- Parameters:
original- the original requestnewHeaders- the new headers- Returns:
- the new request with the new headers
-
createFrom
Creates a newOperationRequestbased on the givenoriginalbut with the givennewParametersapplied. The query string of aGETrequest will be updated to reflect the new parameters.- Parameters:
original- the original requestnewParameters- the new parameters- Returns:
- the new request with the parameters applied
-