Package org.springframework.mock.http.server.reactive

# Interface MockServerHttpRequest.BodyBuilder

All Superinterfaces:
  `MockServerHttpRequest.BaseBuilder<MockServerHttpRequest.BodyBuilder>`

Enclosing class:
  MockServerHttpRequest

public static interface MockServerHttpRequest.BodyBuilder extends MockServerHttpRequest.BaseBuilder<MockServerHttpRequest.BodyBuilder>
A builder that adds a body to the request.

## Method Summary

Modifier and Type
Method
Description
`MockServerHttpRequest`
`body(String body)`
Set the body of the request and build it.
`MockServerHttpRequest`
`body(Publisher<? extends org.springframework.core.io.buffer.DataBuffer> body)`
Set the body of the request and build it.
`MockServerHttpRequest.BodyBuilder`
`contentLength(long contentLength)`
Set the length of the body in bytes, as specified by the `Content-Length` header.
`MockServerHttpRequest.BodyBuilder`
`contentType(org.springframework.http.MediaType contentType)`
Set the media type of the body, as specified by the `Content-Type` header.

### Methods inherited from interface 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`

## Method Details

### contentLength

MockServerHttpRequest.BodyBuilder contentLength(long contentLength)
Set the length of the body in bytes, as specified by the `Content-Length` header.

Parameters:
  `contentLength` - the content length
Returns:
  this builder
See Also:
  - `HttpHeaders.setContentLength(long)`

### contentType

MockServerHttpRequest.BodyBuilder contentType(org.springframework.http.MediaType contentType)
Set the media type of the body, as specified by the `Content-Type` header.

Parameters:
  `contentType` - the content type
Returns:
  this builder
See Also:
  - `HttpHeaders.setContentType(MediaType)`

### body

MockServerHttpRequest body(Publisher<? extends org.springframework.core.io.buffer.DataBuffer> body)
Set the body of the request and build it.

Parameters:
  `body` - the body
Returns:
  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.

Parameters:
  `body` - the body as text
Returns:
  the built request entity