Create a new client with a given base URI, HTTP connector, and optional pool size hint.
(base: Uri, connector: HttpConnector, pool_size: Option<usize>)
| 62 | |
| 63 | /// Create a new client with a given base URI, HTTP connector, and optional pool size hint. |
| 64 | fn with(base: Uri, connector: HttpConnector, pool_size: Option<usize>) -> Self { |
| 65 | let mut builder = hyper_util::client::legacy::Client::builder(hyper_util::rt::TokioExecutor::new()); |
| 66 | builder.http1_max_buf_size(1024 * 1024); |
| 67 | |
| 68 | if let Some(size) = pool_size { |
| 69 | builder.pool_max_idle_per_host(size); |
| 70 | } |
| 71 | |
| 72 | let client = builder.build(connector); |
| 73 | Self { base, client } |
| 74 | } |
| 75 | |
| 76 | fn set_origin<B>(&self, req: Request<B>) -> Result<Request<B>, BoxError> { |
| 77 | let (mut parts, body) = req.into_parts(); |