Class HeadersModifyingOperationPreprocessor
java.lang.Object
org.springframework.restdocs.operation.preprocess.HeadersModifyingOperationPreprocessor
- All Implemented Interfaces:
OperationPreprocessor
An
OperationPreprocessor
that modifies a request or response by adding,
setting, or removing headers.- Since:
- 3.0.0
- Author:
- Jihoon Cha, Andy Wilkinson
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds a header with the givenname
andvalue
.preprocess
(OperationRequest request) Processes the givenrequest
.preprocess
(OperationResponse response) Processes the givenresponse
.Removes the header with the givenname
.Removes the givenvalue
from the header with the givenname
.removeMatching
(String namePattern) Remove headers that match the givennamePattern
regular expression.Sets the header with the givenname
to have the givenvalues
.
-
Constructor Details
-
HeadersModifyingOperationPreprocessor
public HeadersModifyingOperationPreprocessor()
-
-
Method Details
-
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
-
add
Adds a header with the givenname
andvalue
.- Parameters:
name
- the namevalue
- the value- Returns:
this
-
set
Sets the header with the givenname
to have the givenvalues
.- Parameters:
name
- the namevalues
- the values- Returns:
this
-
remove
Removes the header with the givenname
.- Parameters:
name
- the name of the parameter- Returns:
this
-
remove
Removes the givenvalue
from the header with the givenname
.- Parameters:
name
- the namevalue
- the value- Returns:
this
-
removeMatching
Remove headers that match the givennamePattern
regular expression.- Parameters:
namePattern
- the name pattern- Returns:
this
- See Also:
-