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 OperationPreprocessor
Returns anOperationPreprocessor
that will mask the href of hypermedia links in the request or response.static OperationPreprocessor
Returns anOperationPreprocessor
that will mask the href of hypermedia links in the request or response.Returns aHeadersModifyingOperationPreprocessor
that can then be configured to modify the headers of the request or response.Returns aUriModifyingOperationPreprocessor
that will modify URIs in the request or response by changing one or more of their host, scheme, and port.static OperationRequestPreprocessor
preprocessRequest
(OperationPreprocessor... preprocessors) Returns anOperationRequestPreprocessor
that will preprocess the request by applying the givenpreprocessors
to it.preprocessResponse
(OperationPreprocessor... preprocessors) Returns anOperationResponsePreprocessor
that will preprocess the response by applying the givenpreprocessors
to it.static OperationPreprocessor
Returns anOperationPreprocessor
that will pretty print the content of the request or response.static OperationPreprocessor
removeHeaders
(String... headerNames) Deprecated.static OperationPreprocessor
removeMatchingHeaders
(String... headerNamePatterns) Deprecated.since 3.0.0 in favor ofmodifyHeaders()
andHeadersModifyingOperationPreprocessor.removeMatching(String)
static OperationPreprocessor
replacePattern
(Pattern pattern, String replacement) Returns anOperationPreprocessor
that will modify the content of the request or response by replacing occurrences of the givenpattern
with the givenreplacement
.
-
Method Details
-
preprocessRequest
public static OperationRequestPreprocessor preprocessRequest(OperationPreprocessor... preprocessors) Returns anOperationRequestPreprocessor
that will preprocess the request by applying the givenpreprocessors
to it.- Parameters:
preprocessors
- the preprocessors- Returns:
- the request preprocessor
-
preprocessResponse
public static OperationResponsePreprocessor preprocessResponse(OperationPreprocessor... preprocessors) Returns anOperationResponsePreprocessor
that will preprocess the response by applying the givenpreprocessors
to it.- Parameters:
preprocessors
- the preprocessors- Returns:
- the response preprocessor
-
prettyPrint
Returns anOperationPreprocessor
that 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 anOperationPreprocessor
that 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 anOperationPreprocessor
that will remove any headers from the request or response with a name that matches one of the givenheaderNamePatterns
regular expressions.- Parameters:
headerNamePatterns
- the header name patterns- Returns:
- the preprocessor
- See Also:
-
maskLinks
Returns anOperationPreprocessor
that will mask the href of hypermedia links in the request or response.- Returns:
- the preprocessor
-
maskLinks
Returns anOperationPreprocessor
that will mask the href of hypermedia links in the request or response.- Parameters:
mask
- the link mask- Returns:
- the preprocessor
-
replacePattern
Returns anOperationPreprocessor
that will modify the content of the request or response by replacing occurrences of the givenpattern
with the givenreplacement
.- Parameters:
pattern
- the patternreplacement
- the replacement- Returns:
- the preprocessor
-
modifyHeaders
Returns aHeadersModifyingOperationPreprocessor
that can then be configured to modify the headers of the request or response.- Returns:
- the preprocessor
- Since:
- 3.0.0
-
modifyUris
Returns aUriModifyingOperationPreprocessor
that 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)