public static interface WebTestClient.RequestBodySpec extends WebTestClient.RequestHeadersSpec<WebTestClient.RequestBodySpec>
修飾子と型 | メソッドと説明 |
---|---|
WebTestClient.RequestHeadersSpec<?> | body(BodyInserter<?,? super ClientHttpRequest> inserter) リクエストの本文を指定された BodyInserter に設定します。 |
<T,S extends org.reactivestreams.Publisher<T>> | body(S publisher, java.lang.Class<T> elementClass) リクエストの本文を指定された非同期 Publisher に設定します。 |
WebTestClient.RequestBodySpec | contentLength(long contentLength) Content-Length ヘッダーで指定されているように、本文の長さをバイト単位で設定します。 |
WebTestClient.RequestBodySpec | contentType(MediaType contentType) Content-Type ヘッダーで指定されているように、本文のメディア型を設定します。 |
WebTestClient.RequestHeadersSpec<?> | syncBody(java.lang.Object body) リクエストの本文を指定された同期 Object に設定し、リクエストを実行します。 |
accept, acceptCharset, attribute, attributes, cookie, cookies, exchange, header, headers, ifModifiedSince, ifNoneMatch
WebTestClient.RequestBodySpec contentLength(long contentLength)
Content-Length
ヘッダーで指定されているように、本文の長さをバイト単位で設定します。contentLength
- コンテンツの長さ HttpHeaders.setContentLength(long)
WebTestClient.RequestBodySpec contentType(MediaType contentType)
Content-Type
ヘッダーで指定されているように、本文のメディア型を設定します。contentType
- コンテンツ型 HttpHeaders.setContentType(MediaType)
WebTestClient.RequestHeadersSpec<?> body(BodyInserter<?,? super ClientHttpRequest> inserter)
BodyInserter
に設定します。inserter
- インサーター BodyInserters
<T,S extends org.reactivestreams.Publisher<T>> WebTestClient.RequestHeadersSpec<?> body(S publisher, java.lang.Class<T> elementClass)
Publisher
に設定します。T
- パブリッシャーに含まれる要素の型 S
- Publisher
の型 publisher
- リクエストボディデータ elementClass
- パブリッシャーに含まれる要素のクラス WebTestClient.RequestHeadersSpec<?> syncBody(java.lang.Object body)
Object
に設定し、リクエストを実行します。この方法は、次の場合の便利なショートカットです。
.body(BodyInserters.fromObject(object))
ボディは MultiValueMap
で、マルチパートリクエストを作成できます。MultiValueMap
の値は、パーツのボディを表す任意のオブジェクト、またはボディとヘッダーを持つパーツを表す HttpEntity
です。MultiValueMap
body
- リクエストに書き込む Object
Mono