Class UriModifyingOperationPreprocessor
java.lang.Object
org.springframework.restdocs.operation.preprocess.UriModifyingOperationPreprocessor
- All Implemented Interfaces:
OperationPreprocessor
An
OperationPreprocessor
that modifies URIs in the request and in the response
by changing one or more of their host, scheme, and port. URIs in the following
locations are modified:
- Since:
- 2.0.1
- Author:
- Andy Wilkinson
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionModifies the URI to use the givenhost
.port
(int port) Modifies the URI to use the givenport
.preprocess
(OperationRequest request) Processes the givenrequest
.preprocess
(OperationResponse response) Processes the givenresponse
.Removes the port from the URI.Modifies the URI to use the givenscheme
.
-
Constructor Details
-
UriModifyingOperationPreprocessor
public UriModifyingOperationPreprocessor()
-
-
Method Details
-
scheme
Modifies the URI to use the givenscheme
.null
, the default, will leave the scheme unchanged.- Parameters:
scheme
- the scheme- Returns:
this
-
host
Modifies the URI to use the givenhost
.null
, the default, will leave the host unchanged.- Parameters:
host
- the host- Returns:
this
-
port
Modifies the URI to use the givenport
.- Parameters:
port
- the port- Returns:
this
-
removePort
Removes the port from the URI.- Returns:
this
-
preprocess
Description copied from interface:OperationPreprocessor
Processes the givenrequest
.- Specified by:
preprocess
in interfaceOperationPreprocessor
- Parameters:
request
- the request to process- Returns:
- the processed request
-
preprocess
Description copied from interface:OperationPreprocessor
Processes the givenresponse
.- Specified by:
preprocess
in interfaceOperationPreprocessor
- Parameters:
response
- the response to process- Returns:
- the processed response
-