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
There are two ways of configuring request execution:
Create a custom client using HttpClientBuilder, which provides inherent methods for configuring defaults that will be used for all requests executed by the client.
Configure an individual request using extension trait methods provided by RequestBuilderExt. The provided methods have the same names and documentation as the above methods.
To centralize documentation and avoid having two methods with the same in the public API, it would be helpful to centralize these methods into a common trait. Such a trait might look like this:
pubtraitConfigurable{/// Set a timeout for the maximum time allowed for a request-response cycle.////// If not set, no timeout will be enforced.fntimeout(self,timeout:Duration) -> Self;// more methods...}// Clients are configurable...implConfigurableforHttpClientBuilder{// ...}// and so are requests.implConfigurablefor http::request::Builder{// ...}
This is not currently possible, because HttpClientBuilder is a by-value builder (that takes self, while http::request::Builder is a mutable builder (takes &mut self), so the methods cannot have the same signature.
It appears that in the 0.2 next release of http, the builders may change to also be by-value: hyperium/http#191. If that is the case, it may be best to introduce this change at the same time as when we upgrade our http dependency.
The text was updated successfully, but these errors were encountered:
Upgrade to using the recently released http 0.2. Among other things, this moves to by-value builders which allows us to extract request configuration into a common trait as described in #48.
Fixes#48.
Upgrade to using the recently released http 0.2. Among other things, this moves to by-value builders which allows us to extract request configuration into a common trait as described in #48.
This is a breaking change, since the http crate is part of our public API.
Fixes#48.
There are two ways of configuring request execution:
HttpClientBuilder
, which provides inherent methods for configuring defaults that will be used for all requests executed by the client.RequestBuilderExt
. The provided methods have the same names and documentation as the above methods.To centralize documentation and avoid having two methods with the same in the public API, it would be helpful to centralize these methods into a common trait. Such a trait might look like this:
This is not currently possible, becauseHttpClientBuilder
is a by-value builder (that takesself
, whilehttp::request::Builder
is a mutable builder (takes&mut self
), so the methods cannot have the same signature.It appears that in the 0.2 next release of http, the builders may change to also be by-value: hyperium/http#191. If that is the case, it may be best to introduce this change at the same time as when we upgrade our http dependency.The text was updated successfully, but these errors were encountered: