Interface RestTestClient.RequestBodySpec

All Superinterfaces:
RestTestClient.RequestHeadersSpec<RestTestClient.RequestBodySpec>
All Known Subinterfaces:
RestTestClient.RequestBodyUriSpec
Enclosing interface:
RestTestClient

public static interface RestTestClient.RequestBodySpec extends RestTestClient.RequestHeadersSpec<RestTestClient.RequestBodySpec>
Specification for providing the body of a request.
Since:
7.0
Author:
Rob Worsnop, Rossen Stoyanchev
  • Method Details

    • contentLength

      RestTestClient.RequestBodySpec 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 spec for further declaration of the request
      See Also:
      • HttpHeaders.setContentLength(long)
    • contentType

      RestTestClient.RequestBodySpec 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 spec for further declaration of the request
      See Also:
      • HttpHeaders.setContentType(MediaType)
    • body

      Set the body to the given Object value. This method invokes the RestClient.RequestBodySpec.body(Object) (Object) bodyValue} method on the underlying RestClient.
      Parameters:
      body - the value to write to the request body
      Returns:
      a spec for further declaration of the request