Class HeaderAssertions
java.lang.Object
org.springframework.test.web.reactive.server.HeaderAssertions
Assertions on headers of the response.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev, Brian Clozel, Sam Brannen
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptioncacheControl(CacheControl cacheControl) Expect a "Cache-Control" header with the given value.contentDisposition(ContentDisposition contentDisposition) Expect a "Content-Disposition" header with the given value.contentLength(long contentLength) Expect a "Content-Length" header with the given value.contentType(String mediaType) Expect a "Content-Type" header with the given value.contentType(MediaType mediaType) Expect a "Content-Type" header with the given value.contentTypeCompatibleWith(String mediaType) Expect a "Content-Type" header compatible with the given value.contentTypeCompatibleWith(MediaType mediaType) Expect a "Content-Type" header compatible with the given value.doesNotExist(String name) Expect that the header with the given name is not present.Expect that the header with the given name is present.expires(long expires) Expect an "Expires" header with the given value.lastModified(long lastModified) Expect a "Last-Modified" header with the given value.Expect a "Location" header with the given value.Consume the first value of the named response header.Assert the first value of the response header with a HamcrestMatcher.valueEquals(String headerName, long value) Expect a header with the given name to match the given long value.valueEquals(String headerName, String... values) Expect a header with the given name to match the specified values.valueEqualsDate(String headerName, long value) Expect a header with the given name to match the specified long value parsed into a date using the preferred date format described in RFC 7231.valueMatches(String name, String pattern) Match the first value of the response header with a regex.Consume all values of the named response header.Assert all values of the response header with a HamcrestMatcher.valuesMatch(String name, String... patterns) Match all values of the response header with the given regex patterns which are applied to the values of the header in the same order.
- 
Method Details- 
valueEqualsExpect a header with the given name to match the specified values.
- 
valueEqualsExpect a header with the given name to match the given long value.- Since:
- 5.3
 
- 
valueEqualsDateExpect a header with the given name to match the specified long value parsed into a date using the preferred date format described in RFC 7231.An AssertionErroris thrown if the response does not contain the specified header, or if the suppliedvaluedoes not match the primary header value.- Since:
- 5.3
 
- 
valueMatchesMatch the first value of the response header with a regex.- Parameters:
- name- the header name
- pattern- the regex pattern
 
- 
valuesMatchMatch all values of the response header with the given regex patterns which are applied to the values of the header in the same order. Note that the number of patterns must match the number of actual values.- Parameters:
- name- the header name
- patterns- one or more regex patterns, one per expected value
- Since:
- 5.3
 
- 
valueAssert the first value of the response header with a HamcrestMatcher.- Parameters:
- name- the header name
- matcher- the matcher to use
- Since:
- 5.1
 
- 
values
- 
valueConsume the first value of the named response header.- Parameters:
- name- the header name
- consumer- the consumer to use
- Since:
- 5.1
 
- 
valuesConsume all values of the named response header.- Parameters:
- name- the header name
- consumer- the consumer to use
- Since:
- 5.3
 
- 
existsExpect that the header with the given name is present.- Since:
- 5.0.3
 
- 
doesNotExistExpect that the header with the given name is not present.
- 
cacheControlExpect a "Cache-Control" header with the given value.
- 
contentDispositionExpect a "Content-Disposition" header with the given value.
- 
contentLengthExpect a "Content-Length" header with the given value.
- 
contentTypeExpect a "Content-Type" header with the given value.
- 
contentTypeExpect a "Content-Type" header with the given value.
- 
contentTypeCompatibleWithExpect a "Content-Type" header compatible with the given value.
- 
contentTypeCompatibleWithExpect a "Content-Type" header compatible with the given value.
- 
expiresExpect an "Expires" header with the given value.
- 
lastModifiedExpect a "Last-Modified" header with the given value.
- 
locationExpect a "Location" header with the given value.- Since:
- 5.3
 
 
-