类 HeaderAssertions
java.lang.Object
cn.taketoday.test.web.reactive.server.HeaderAssertions
Assertions on headers of the response.
- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev, Brian Clozel, Sam Brannen
- 另请参阅:
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明private WebTestClient.ResponseSpecassertHeader(String name, Object expected, Object actual) cacheControl(cn.taketoday.http.CacheControl cacheControl) Expect a "Cache-Control" header with the given value.contentDisposition(cn.taketoday.http.ContentDisposition contentDisposition) Expect a "Content-Disposition" header with the given value.contentLength(long contentLength) Expect a "Content-Length" header with the given value.contentType(cn.taketoday.http.MediaType mediaType) Expect a "Content-Type" header with the given value.contentType(String mediaType) Expect a "Content-Type" header with the given value.contentTypeCompatibleWith(cn.taketoday.http.MediaType mediaType) Expect a "Content-Type" header compatible with the given value.contentTypeCompatibleWith(String 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.private cn.taketoday.http.HttpHeadersprivate StringgetMessage(String headerName) private StringgetRequiredValue(String name) getRequiredValues(String name) 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.
-
字段详细资料
-
exchangeResult
-
responseSpec
-
-
构造器详细资料
-
HeaderAssertions
HeaderAssertions(ExchangeResult result, WebTestClient.ResponseSpec spec)
-
-
方法详细资料
-
valueEquals
Expect a header with the given name to match the specified values. -
valueEquals
Expect a header with the given name to match the given long value. -
valueEqualsDate
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.An
AssertionErroris thrown if the response does not contain the specified header, or if the suppliedvaluedoes not match the primary header value.- 从以下版本开始:
- 4.0
-
valueMatches
Match the first value of the response header with a regex.- 参数:
name- the header namepattern- the regex pattern
-
valuesMatch
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. Note that the number of patterns must match the number of actual values.- 参数:
name- the header namepatterns- one or more regex patterns, one per expected value- 从以下版本开始:
- 4.0
-
value
Assert the first value of the response header with a HamcrestMatcher.- 参数:
name- the header namematcher- the matcher to use
-
values
public WebTestClient.ResponseSpec values(String name, org.hamcrest.Matcher<? super Iterable<String>> matcher) Assert all values of the response header with a HamcrestMatcher.- 参数:
name- the header namematcher- the matcher to use- 从以下版本开始:
- 4.0
-
value
Consume the first value of the named response header.- 参数:
name- the header nameconsumer- the consumer to use
-
values
Consume all values of the named response header.- 参数:
name- the header nameconsumer- the consumer to use- 从以下版本开始:
- 4.0
-
getRequiredValue
-
getRequiredValues
-
exists
Expect that the header with the given name is present. -
doesNotExist
Expect that the header with the given name is not present. -
cacheControl
Expect a "Cache-Control" header with the given value. -
contentDisposition
public WebTestClient.ResponseSpec contentDisposition(cn.taketoday.http.ContentDisposition contentDisposition) Expect a "Content-Disposition" header with the given value. -
contentLength
Expect a "Content-Length" header with the given value. -
contentType
Expect a "Content-Type" header with the given value. -
contentType
Expect a "Content-Type" header with the given value. -
contentTypeCompatibleWith
Expect a "Content-Type" header compatible with the given value. -
contentTypeCompatibleWith
Expect a "Content-Type" header compatible with the given value. -
expires
Expect an "Expires" header with the given value. -
lastModified
Expect a "Last-Modified" header with the given value. -
location
Expect a "Location" header with the given value.- 从以下版本开始:
- 4.0
-
getHeaders
private cn.taketoday.http.HttpHeaders getHeaders() -
getMessage
-
assertHeader
private WebTestClient.ResponseSpec assertHeader(String name, @Nullable Object expected, @Nullable Object actual)
-