Class HeaderAssertions
java.lang.Object
org.springframework.test.web.support.AbstractHeaderAssertions<ExchangeResult, WebTestClient.ResponseSpec>
org.springframework.test.web.reactive.server.HeaderAssertions
public class HeaderAssertions
extends AbstractHeaderAssertions<ExchangeResult, WebTestClient.ResponseSpec>
Assertions on headers of the response.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev, Brian Clozel, Sam Brannen, Rob Worsnop
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionprotected voidassertWithDiagnostics(Runnable assertion) Subclasses must implement this to assert with diagnostics.protected HttpHeadersSubclasses must implement this to provide access to response headers.Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.in favor ofConsumer-based variantsMethods inherited from class AbstractHeaderAssertions
cacheControl, contentDisposition, contentLength, contentType, contentType, contentTypeCompatibleWith, contentTypeCompatibleWith, doesNotExist, exists, expires, getExchangeResult, getMessage, getResponseSpec, lastModified, location, value, valueEquals, valueEquals, valueEqualsDate, valueMatches, values, valuesMatch
-
Method Details
-
getResponseHeaders
Description copied from class:AbstractHeaderAssertionsSubclasses must implement this to provide access to response headers.- Specified by:
getResponseHeadersin classAbstractHeaderAssertions<ExchangeResult, WebTestClient.ResponseSpec>
-
assertWithDiagnostics
Description copied from class:AbstractHeaderAssertionsSubclasses must implement this to assert with diagnostics.- Specified by:
assertWithDiagnosticsin classAbstractHeaderAssertions<ExchangeResult, WebTestClient.ResponseSpec>
-
value
@Deprecated(since="7.0", forRemoval=true) public WebTestClient.ResponseSpec value(String name, Matcher<? super String> matcher) Deprecated, for removal: This API element is subject to removal in a future version.in favor ofConsumer-based variantsAssert the first value of the response header with a HamcrestMatcher.- Parameters:
name- the header namematcher- the matcher to use
-
values
@Deprecated(since="7.0", forRemoval=true) public WebTestClient.ResponseSpec values(String name, Matcher<? super Iterable<String>> matcher) Deprecated, for removal: This API element is subject to removal in a future version.in favor ofConsumer-based variantsAssert all values of the response header with a HamcrestMatcher.- Parameters:
name- the header namematcher- the matcher to use
-
Consumer-based variants