接口 MockServerHttpRequest.BodyBuilder
public static interface MockServerHttpRequest.BodyBuilder extends MockServerHttpRequest.BaseBuilder<MockServerHttpRequest.BodyBuilder>
A builder that adds a body to the request.
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 MockServerHttpRequestbody(String body)Set the body of the request and build it.MockServerHttpRequestbody(org.reactivestreams.Publisher<? extends DataBuffer> body)Set the body of the request and build it.MockServerHttpRequest.BodyBuildercontentLength(long contentLength)Set the length of the body in bytes, as specified by theContent-Lengthheader.MockServerHttpRequest.BodyBuildercontentType(MediaType contentType)Set the media type of the body, as specified by theContent-Typeheader.从接口继承的方法 org.springframework.mock.http.server.reactive.MockServerHttpRequest.BaseBuilder
accept, acceptCharset, acceptLanguageAsLocales, build, contextPath, cookie, cookies, header, headers, ifModifiedSince, ifNoneMatch, ifUnmodifiedSince, localAddress, queryParam, queryParams, range, remoteAddress, sslInfo
方法详细资料
contentLength
MockServerHttpRequest.BodyBuilder contentLength(long contentLength)
Set the length of the body in bytes, as specified by theContent-Lengthheader.- 参数:
contentLength- the content length- 返回:
- this builder
- 另请参阅:
HttpHeaders.setContentLength(long)
contentType
MockServerHttpRequest.BodyBuilder contentType(MediaType contentType)
Set the media type of the body, as specified by theContent-Typeheader.- 参数:
contentType- the content type- 返回:
- this builder
- 另请参阅:
HttpHeaders.setContentType(MediaType)
body
MockServerHttpRequest body(org.reactivestreams.Publisher<? extends DataBuffer> body)
Set the body of the request and build it.- 参数:
body- the body- 返回:
- the built request entity
body
MockServerHttpRequest body(String body)
Set the body of the request and build it.The String is assumed to be UTF-8 encoded unless the request has a "content-type" header with a charset attribute.
- 参数:
body- the body as text- 返回:
- the built request entity