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
HttpRequest provided by HttpClient contains a ContentSource which is a collection of Objects that would be sent as payload of the HTTP request sent by HttpClient.
In order for Ribbon or any other higher level framework to provide retries, it is imperative that it should be able to send the same request to multiple clients. However, with the current model, the same HttpRequest can not be reused as the ContentSource contains state of the iteration.
Assuming we want to support usecases like this, without forcing the users to clone the object before every use, there is the following we have to do:
The framework overwrites any state changes it makes to headers while sending the request, eg: The host header.
The content source set in the HttpRequest should provide a way to reset state. This can be achieved in two possible ways:
Provide a reset method on the ContentSource. This is too intrusive for content sources that do not need reuse and providing a different interface adds to confusion.
Return a new instance of ContentSource, every time a request is to be sent i.e. instead of returning the same contentSource object here return a new instance every time. In order to achieve this, we would have to optionally provide a override method of withContentSource() that takes a ContentSourceFactory. In case, this factory is set, we would use this factory to create the new content source instance, else we will use the content source object as is.
It is not clear what the intention of the withContent_() APIs is when such methods are called multiple times. To me, the with_ methods gives a feeling that the final state of the HttpRequest is the union of those. But it seems that the real intention is that they should override each other. Also, the raw content and content are mutually exclusive. Should we reflect those points in the API design and make the intention clear to the user?
HttpRequest provided by HttpClient contains a ContentSource which is a collection of Objects that would be sent as payload of the HTTP request sent by HttpClient.
In order for Ribbon or any other higher level framework to provide retries, it is imperative that it should be able to send the same request to multiple clients. However, with the current model, the same HttpRequest can not be reused as the ContentSource contains state of the iteration.
Assuming we want to support usecases like this, without forcing the users to clone the object before every use, there is the following we have to do:
@benjchristensen @g9yuayon @allenxwang Thoughts?
The text was updated successfully, but these errors were encountered: