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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a header with the givennameandvalue.preprocess(OperationRequest request) Processes the givenrequest.preprocess(OperationResponse response) Processes the givenresponse.Removes the header with the givenname.Removes the givenvaluefrom the header with the givenname.removeMatching(String namePattern) Remove headers that match the givennamePatternregular expression.Sets the header with the givennameto have the givenvalues.
-
Constructor Details
-
HeadersModifyingOperationPreprocessor
public HeadersModifyingOperationPreprocessor()
-
-
Method Details
-
preprocess
Description copied from interface:OperationPreprocessorProcesses the givenrequest.- Specified by:
preprocessin interfaceOperationPreprocessor- Parameters:
request- the request to process- Returns:
- the processed request
-
preprocess
Description copied from interface:OperationPreprocessorProcesses the givenresponse.- Specified by:
preprocessin interfaceOperationPreprocessor- Parameters:
response- the response to process- Returns:
- the processed response
-
add
Adds a header with the givennameandvalue.- Parameters:
name- the namevalue- the value- Returns:
this
-
set
Sets the header with the givennameto 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 givenvaluefrom the header with the givenname.- Parameters:
name- the namevalue- the value- Returns:
this
-
removeMatching
Remove headers that match the givennamePatternregular expression.- Parameters:
namePattern- the name pattern- Returns:
this- See Also:
-