Class Preprocessors
java.lang.Object
org.springframework.restdocs.operation.preprocess.Preprocessors
Static factory methods for creating
OperationPreprocessors that can be applied to an Operation's
request or response before it is
documented.- Author:
- Andy Wilkinson, Roland Huss, Jihoon Cha
-
Method Summary
Modifier and TypeMethodDescriptionstatic OperationPreprocessorReturns anOperationPreprocessorthat will mask the href of hypermedia links in the request or response.static OperationPreprocessorReturns anOperationPreprocessorthat will mask the href of hypermedia links in the request or response.Returns aHeadersModifyingOperationPreprocessorthat can then be configured to modify the headers of the request or response.Returns aParametersModifyingOperationPreprocessorthat can then be configured to modify the parameters of the request.Returns aUriModifyingOperationPreprocessorthat will modify URIs in the request or response by changing one or more of their host, scheme, and port.static OperationRequestPreprocessorpreprocessRequest(OperationPreprocessor... preprocessors) Returns anOperationRequestPreprocessorthat will preprocess the request by applying the givenpreprocessorsto it.preprocessResponse(OperationPreprocessor... preprocessors) Returns anOperationResponsePreprocessorthat will preprocess the response by applying the givenpreprocessorsto it.static OperationPreprocessorReturns anOperationPreprocessorthat will pretty print the content of the request or response.static OperationPreprocessorremoveHeaders(String... headerNames) Deprecated.static OperationPreprocessorremoveMatchingHeaders(String... headerNamePatterns) Deprecated.since 3.0.0 in favor ofmodifyHeaders()andHeadersModifyingOperationPreprocessor.removeMatching(String)static OperationPreprocessorreplacePattern(Pattern pattern, String replacement) Returns anOperationPreprocessorthat will modify the content of the request or response by replacing occurrences of the givenpatternwith the givenreplacement.
-
Method Details
-
preprocessRequest
public static OperationRequestPreprocessor preprocessRequest(OperationPreprocessor... preprocessors) Returns anOperationRequestPreprocessorthat will preprocess the request by applying the givenpreprocessorsto it.- Parameters:
preprocessors- the preprocessors- Returns:
- the request preprocessor
-
preprocessResponse
public static OperationResponsePreprocessor preprocessResponse(OperationPreprocessor... preprocessors) Returns anOperationResponsePreprocessorthat will preprocess the response by applying the givenpreprocessorsto it.- Parameters:
preprocessors- the preprocessors- Returns:
- the response preprocessor
-
prettyPrint
Returns anOperationPreprocessorthat will pretty print the content of the request or response.- Returns:
- the preprocessor
-
removeHeaders
Deprecated.since 3.0.0 in favor ofmodifyHeaders()andHeadersModifyingOperationPreprocessor.remove(String)Returns anOperationPreprocessorthat will remove any header from the request or response with a name that is equal to one of the givenheadersToRemove.- Parameters:
headerNames- the header names- Returns:
- the preprocessor
- See Also:
-
removeMatchingHeaders
Deprecated.since 3.0.0 in favor ofmodifyHeaders()andHeadersModifyingOperationPreprocessor.removeMatching(String)Returns anOperationPreprocessorthat will remove any headers from the request or response with a name that matches one of the givenheaderNamePatternsregular expressions.- Parameters:
headerNamePatterns- the header name patterns- Returns:
- the preprocessor
- See Also:
-
maskLinks
Returns anOperationPreprocessorthat will mask the href of hypermedia links in the request or response.- Returns:
- the preprocessor
-
maskLinks
Returns anOperationPreprocessorthat will mask the href of hypermedia links in the request or response.- Parameters:
mask- the link mask- Returns:
- the preprocessor
-
replacePattern
Returns anOperationPreprocessorthat will modify the content of the request or response by replacing occurrences of the givenpatternwith the givenreplacement.- Parameters:
pattern- the patternreplacement- the replacement- Returns:
- the preprocessor
-
modifyParameters
Returns aParametersModifyingOperationPreprocessorthat can then be configured to modify the parameters of the request.- Returns:
- the preprocessor
- Since:
- 1.1.0
-
modifyHeaders
Returns aHeadersModifyingOperationPreprocessorthat can then be configured to modify the headers of the request or response.- Returns:
- the preprocessor
- Since:
- 3.0.0
-
modifyUris
Returns aUriModifyingOperationPreprocessorthat will modify URIs in the request or response by changing one or more of their host, scheme, and port.- Returns:
- the preprocessor
- Since:
- 2.0.1
-
modifyHeaders()andHeadersModifyingOperationPreprocessor.remove(String)