Class ResponseHeadersSnippet
java.lang.Object
org.springframework.restdocs.snippet.TemplatedSnippet
org.springframework.restdocs.headers.AbstractHeadersSnippet
org.springframework.restdocs.headers.ResponseHeadersSnippet
- All Implemented Interfaces:
Snippet
A
Snippet
that documents the headers in a response.- Author:
- Andreas Evers, Andy Wilkinson
- See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
ResponseHeadersSnippet
(List<HeaderDescriptor> descriptors) Creates a newResponseHeadersSnippet
that will document the headers in the response using the givendescriptors
.protected
ResponseHeadersSnippet
(List<HeaderDescriptor> descriptors, Map<String, Object> attributes) Creates a newResponseHeadersSnippet
that will document the headers in the response using the givendescriptors
. -
Method Summary
Modifier and TypeMethodDescriptionfinal ResponseHeadersSnippet
and
(List<HeaderDescriptor> additionalDescriptors) Returns a newResponseHeadersSnippet
configured with this snippet's attributes and its descriptors combined with the givenadditionalDescriptors
.final ResponseHeadersSnippet
and
(HeaderDescriptor... additionalDescriptors) Returns a newResponseHeadersSnippet
configured with this snippet's attributes and its descriptors combined with the givenadditionalDescriptors
.extractActualHeaders
(Operation operation) Extracts the names of the headers from the request or response of the givenoperation
.Methods inherited from class org.springframework.restdocs.headers.AbstractHeadersSnippet
createModel, createModelForDescriptor, findMissingHeaders, getHeaderDescriptors
Methods inherited from class org.springframework.restdocs.snippet.TemplatedSnippet
document, getAttributes, getSnippetName
-
Constructor Details
-
ResponseHeadersSnippet
Creates a newResponseHeadersSnippet
that will document the headers in the response using the givendescriptors
.- Parameters:
descriptors
- the descriptors
-
ResponseHeadersSnippet
Creates a newResponseHeadersSnippet
that will document the headers in the response using the givendescriptors
. The givenattributes
will be included in the model during template rendering.- Parameters:
descriptors
- the descriptorsattributes
- the additional attributes
-
-
Method Details
-
extractActualHeaders
Description copied from class:AbstractHeadersSnippet
Extracts the names of the headers from the request or response of the givenoperation
.- Specified by:
extractActualHeaders
in classAbstractHeadersSnippet
- Parameters:
operation
- the operation- Returns:
- the header names
-
and
Returns a newResponseHeadersSnippet
configured with this snippet's attributes and its descriptors combined with the givenadditionalDescriptors
.- Parameters:
additionalDescriptors
- the additional descriptors- Returns:
- the new snippet
-
and
Returns a newResponseHeadersSnippet
configured with this snippet's attributes and its descriptors combined with the givenadditionalDescriptors
.- Parameters:
additionalDescriptors
- the additional descriptors- Returns:
- the new snippet
-