Package org.springframework.web.client

# Interface RestClient.RequestHeadersSpec.ConvertibleClientHttpResponse

All Superinterfaces:
  `AutoCloseable`, `ClientHttpResponse`, `Closeable`, `HttpInputMessage`, `HttpMessage`

Enclosing interface:
  RestClient.RequestHeadersSpec<S extends RestClient.RequestHeadersSpec<S>>

public static interface RestClient.RequestHeadersSpec.ConvertibleClientHttpResponse extends ClientHttpResponse
Extension of `ClientHttpResponse` that can convert the body.

## Method Summary

Modifier and Type
Method
Description
`<T> T`
`bodyTo(Class<T> bodyType)`
Extract the response body as an object of the given type.
`<T> T`
`bodyTo(org.springframework.core.ParameterizedTypeReference<T> bodyType)`
Extract the response body as an object of the given type.

### Methods inherited from interface org.springframework.http.client.ClientHttpResponse

`close, getRawStatusCode, getStatusCode, getStatusText`

### Methods inherited from interface org.springframework.http.HttpInputMessage

`getBody`

### Methods inherited from interface org.springframework.http.HttpMessage

`getHeaders`

## Method Details

### bodyTo

@Nullable <T> T bodyTo(Class<T> bodyType)
Extract the response body as an object of the given type.

Type Parameters:
  `T` - the body type
Parameters:
  `bodyType` - the type of return value
Returns:
  the body, or `null` if no response body was available

### bodyTo

@Nullable <T> T bodyTo(org.springframework.core.ParameterizedTypeReference<T> bodyType)
Extract the response body as an object of the given type.

Type Parameters:
  `T` - the body type
Parameters:
  `bodyType` - the type of return value
Returns:
  the body, or `null` if no response body was available