Class RequestHeadersSnippet
java.lang.Object
org.springframework.restdocs.snippet.TemplatedSnippet
org.springframework.restdocs.headers.AbstractHeadersSnippet
org.springframework.restdocs.headers.RequestHeadersSnippet
- All Implemented Interfaces:
Snippet
A
Snippet that documents the headers in a request.- Author:
- Andreas Evers, Andy Wilkinson
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRequestHeadersSnippet(List<HeaderDescriptor> descriptors) Creates a newRequestHeadersSnippetthat will document the headers in the request using the givendescriptors.protectedRequestHeadersSnippet(List<HeaderDescriptor> descriptors, @Nullable Map<String, Object> attributes) Creates a newRequestHeadersSnippetthat will document the headers in the request using the givendescriptors. -
Method Summary
Modifier and TypeMethodDescriptionfinal RequestHeadersSnippetand(List<HeaderDescriptor> additionalDescriptors) Returns a newRequestHeadersSnippetconfigured with this snippet's attributes and its descriptors combined with the givenadditionalDescriptors.final RequestHeadersSnippetand(HeaderDescriptor... additionalDescriptors) Returns a newRequestHeadersSnippetconfigured 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 AbstractHeadersSnippet
createModel, createModelForDescriptor, findMissingHeaders, getHeaderDescriptorsMethods inherited from class TemplatedSnippet
document, getAttributes, getSnippetName
-
Constructor Details
-
RequestHeadersSnippet
Creates a newRequestHeadersSnippetthat will document the headers in the request using the givendescriptors.- Parameters:
descriptors- the descriptors
-
RequestHeadersSnippet
protected RequestHeadersSnippet(List<HeaderDescriptor> descriptors, @Nullable Map<String, Object> attributes) Creates a newRequestHeadersSnippetthat will document the headers in the request 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 newRequestHeadersSnippetconfigured with this snippet's attributes and its descriptors combined with the givenadditionalDescriptors.- Parameters:
additionalDescriptors- the additional descriptors- Returns:
- the new snippet
-
and
Returns a newRequestHeadersSnippetconfigured with this snippet's attributes and its descriptors combined with the givenadditionalDescriptors.- Parameters:
additionalDescriptors- the additional descriptors- Returns:
- the new snippet
-