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
HttpClientResponse follows the model that is suitable for streaming payloads i.e. HttpClientResponse.getContent() returns an Observable which can contain multiple elements. Since, this is the only way to use an HttpClientResponse, even in cases when the generated response is not streaming i.e. the content Observable produces a single element, the API does not simplify this use case.
The following is the typical interaction:
This approach is more convenient for non-streaming responses as it provides both content and headers at the time. It also does not add any overhead as the response is already aggregated by netty.
Possible issues
Since, the proposed operator disregards any content elements > 1, if this is used with a streaming response, it will terminate the stream after one onNext().
If we can name the operator in a way which is more intuitive to the users, this may not be that big an issue.
The text was updated successfully, but these errors were encountered:
Problem
HttpClientResponse
follows the model that is suitable for streaming payloads i.e.HttpClientResponse.getContent()
returns anObservable
which can contain multiple elements. Since, this is the only way to use anHttpClientResponse
, even in cases when the generated response is not streaming i.e. the contentObservable
produces a single element, the API does not simplify this use case.The following is the typical interaction:
Although the above works, it is a relatively cumbersome way of handling a non-streaming response.
Proposal
The following proposes a more specialized non-streaming interaction by defining a new response class (we can discuss an appropriate name):
and an operator:
Using which, the client can now look like:
This approach is more convenient for non-streaming responses as it provides both content and headers at the time. It also does not add any overhead as the response is already aggregated by netty.
Possible issues
Since, the proposed operator disregards any content elements > 1, if this is used with a streaming response, it will terminate the stream after one
onNext()
.If we can name the operator in a way which is more intuitive to the users, this may not be that big an issue.
The text was updated successfully, but these errors were encountered: