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
It is impossible to add middlware to HttpClientBuilder
let middleware = RpcServiceBuilder::new().rpc_logger(1024).layer_fn(|service| MyMiddleware{
service,count: std::sync::Arc::new(tokio::sync::Mutex::new(0)),});let client = HttpClientBuilder::default().set_rpc_middleware(middleware).build(url);
It turned out that client does not have a type of HttpClient which is actually HttpClient<RpcLogger<http_client::rpc_service::RpcService<_>>>
But instead it has a type HttpClient<RpcLogger<MyMiddleware<http_client::rpc_service::RpcService<_>>>>
which I can not define anywhere (as a function return type) because http_client::rpc_service::RpcService is private. The struct itself is public but the module is private so I can't just return client from function or use it as a struct property.