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
ConstructorsModifierConstructorDescriptionprotectedResponseHeadersSnippet(List<HeaderDescriptor> descriptors) Creates a newResponseHeadersSnippetthat will document the headers in the response using the givendescriptors.protectedResponseHeadersSnippet(List<HeaderDescriptor> descriptors, Map<String, Object> attributes) Creates a newResponseHeadersSnippetthat will document the headers in the response using the givendescriptors. -
Method Summary
Modifier and TypeMethodDescriptionfinal ResponseHeadersSnippetand(List<HeaderDescriptor> additionalDescriptors) Returns a newResponseHeadersSnippetconfigured with this snippet's attributes and its descriptors combined with the givenadditionalDescriptors.final ResponseHeadersSnippetand(HeaderDescriptor... additionalDescriptors) Returns a newResponseHeadersSnippetconfigured 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, getHeaderDescriptorsMethods inherited from class org.springframework.restdocs.snippet.TemplatedSnippet
document, getAttributes, getSnippetName
-
Constructor Details
-
ResponseHeadersSnippet
Creates a newResponseHeadersSnippetthat will document the headers in the response using the givendescriptors.- Parameters:
descriptors- the descriptors
-
ResponseHeadersSnippet
Creates a newResponseHeadersSnippetthat will document the headers in the response using the givendescriptors. The givenattributeswill be included in the model during template rendering.- Parameters:
descriptors- the descriptorsattributes- the additional attributes
-
-
Method Details
-
extractActualHeaders
Description copied from class:AbstractHeadersSnippetExtracts the names of the headers from the request or response of the givenoperation.- Specified by:
extractActualHeadersin classAbstractHeadersSnippet- Parameters:
operation- the operation- Returns:
- the header names
-
and
Returns a newResponseHeadersSnippetconfigured with this snippet's attributes and its descriptors combined with the givenadditionalDescriptors.- Parameters:
additionalDescriptors- the additional descriptors- Returns:
- the new snippet
-
and
Returns a newResponseHeadersSnippetconfigured with this snippet's attributes and its descriptors combined with the givenadditionalDescriptors.- Parameters:
additionalDescriptors- the additional descriptors- Returns:
- the new snippet
-