Update docs for HTTP interface clients return values

See gh-30959
This commit is contained in:
Olga MaciaszekSharma 2023-07-27 18:02:51 +02:00 committed by rstoyanchev
parent cc9278666d
commit 0d4010841e
1 changed files with 49 additions and 18 deletions

View File

@ -495,45 +495,76 @@ method parameters:
[[rest-http-interface-return-values]]
=== Return Values
Annotated, HTTP exchange methods support the following return values:
The supported return values vary depending on whether you are using
`HttpExchangeAdapter` or `ReactorHttpExchangeAdapter`.
When using `HttpExchangeAdapter`, annotated HTTP exchange methods support
the following return values:
[cols="1,2", options="header"]
|===
| Method return value | Description
| `void`, `Mono<Void>`
| Perform the given request, and release the response content, if any.
| `void`
| Perform the given request.
| `HttpHeaders`, `Mono<HttpHeaders>`
| Perform the given request, release the response content, if any, and return the
response headers.
| `HttpHeaders`
| Perform the given request and return the response headers.
| `<T>`, `Mono<T>`
| `<T>`
| Perform the given request and decode the response content to the declared return type.
| `<T>`, `Flux<T>`
| Perform the given request and decode the response content to a stream of the declared
element type.
| `ResponseEntity<Void>`
| Perform the given request and return a `ResponseEntity` with the status and headers.
| `ResponseEntity<Void>`, `Mono<ResponseEntity<Void>>`
| Perform the given request, and release the response content, if any, and return a
`ResponseEntity` with the status and headers.
| `ResponseEntity<T>`, `Mono<ResponseEntity<T>>`
| `ResponseEntity<T>`
| Perform the given request, decode the response content to the declared return type, and
return a `ResponseEntity` with the status, headers, and the decoded body.
|===
When using `ReactorHttpExchangeAdapter`, annotated HTTP exchange methods support
all the same values as the ones supported by `HttpExchangeAdapter`
and also the following ones:
[cols="1,2", options="header"]
|===
| Method return value | Description
| `Mono<Void>`
| Perform the given request, and release the response content, if any.
| `Mono<HttpHeaders>`
| Perform the given request, release the response content, if any, and return the
response headers.
| `Mono<T>`
| Perform the given request and decode the response content to the declared return type.
| `Flux<T>`
| Perform the given request and decode the response content to a stream of the declared
element type.
| `Mono<ResponseEntity<Void>>`
| Perform the given request, and release the response content, if any, and return a
`ResponseEntity` with the status and headers.
| `Mono<ResponseEntity<T>>`
| Perform the given request, decode the response content to the declared return type, and
return a `ResponseEntity` with the status, headers, and the decoded body.
| `Mono<ResponseEntity<Flux<T>>`
| Perform the given request, decode the response content to a stream of the declared
element type, and return a `ResponseEntity` with the status, headers, and the decoded
response body stream.
element type, and return a `ResponseEntity` with the status, headers, and the decoded
response body stream.
|===
TIP: You can also use any other async or reactive types registered in the
`ReactiveAdapterRegistry`.
By default, the behavior of HTTP service methods with synchronous (blocking) method
While using the `ReactorHttpExchangeAdapter`, by default, the behavior
of HTTP service methods with synchronous (blocking) method
signature depends on connection and timeout settings of the underlying HTTP client.
`HttpServiceProxyFactory.Builder` does expose a `blockTimeout` option that also lets you
configure the maximum time to block for a response, but we recommend configuring timeout