You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The HttpRequest uses Flux<ByteBuffer> to carry body from upper layers to the HttpClient. Consider changing that carrier to something that defers assumption of what's really backing the payload (whether it's stream, buffer, byte[] or flux) until absolutely necessary.
For example today binary payloads are eagerly converted to flux in convenience layers - and then often converted to something else at http client layer (apart from reactor-netty that speaks flux). If somebody is providing InputStream as upload data source then the decision how to use that should be up to http client how best consume that payload.
Known challenges:
RestProxy - how do we validate length for different BinaryDataContent types?
RetryPolicy - This is tightly coupled to Flux operators. How do we retry?
Should we generalize beyond BinaryData ?
How do we leverage each http client's consumption options to minimize transformations?
How do we leverage seekability of files or in memory buffers to remove body buffering for some scenarios?
The usage of HttpRequest.body is widespread. Those more difficult usage patterns (like RetryPolicy) might be deferred (i.e. conversion to flux) and a work item to cover that created. The priority should be to cover sync/async RestProxy logic first.
The text was updated successfully, but these errors were encountered:
kasobol-msft
changed the title
Investigate usage of BinaryData as HttpRequest body carrier.
SyncStack - Investigate usage of BinaryData as HttpRequest body carrier.
Feb 11, 2022
The
HttpRequest
usesFlux<ByteBuffer>
to carry body from upper layers to theHttpClient
. Consider changing that carrier to something that defers assumption of what's really backing the payload (whether it's stream, buffer, byte[] or flux) until absolutely necessary.For example today binary payloads are eagerly converted to flux in convenience layers - and then often converted to something else at http client layer (apart from reactor-netty that speaks flux). If somebody is providing InputStream as upload data source then the decision how to use that should be up to http client how best consume that payload.
Known challenges:
The usage of HttpRequest.body is widespread. Those more difficult usage patterns (like RetryPolicy) might be deferred (i.e. conversion to flux) and a work item to cover that created. The priority should be to cover sync/async RestProxy logic first.
The text was updated successfully, but these errors were encountered: