feat: add GrpcMethod extension into request for client (#1275)

* feat: add GrpcMethod extension into request for client

* refactor: change GrpcMethod fields into private and expose methods instead

* refactor: hide GrpcMethod::new in doc

---------

Co-authored-by: Lucio Franco <luciofranco14@gmail.com>
This commit is contained in:
林玮 (Jade Lin)
2023-02-23 18:06:45 +08:00
committed by GitHub
parent 1547f968b4
commit 7a6b20d8ef
9 changed files with 207 additions and 85 deletions
+8 -2
View File
@@ -148,7 +148,10 @@ pub mod health_client {
let path = http::uri::PathAndQuery::from_static(
"/grpc.health.v1.Health/Check",
);
self.inner.unary(request.into_request(), path, codec).await
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("grpc.health.v1.Health", "Check"));
self.inner.unary(req, path, codec).await
}
/// Performs a watch for the serving status of the requested service.
/// The server will immediately send back a message indicating the current
@@ -185,7 +188,10 @@ pub mod health_client {
let path = http::uri::PathAndQuery::from_static(
"/grpc.health.v1.Health/Watch",
);
self.inner.server_streaming(request.into_request(), path, codec).await
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("grpc.health.v1.Health", "Watch"));
self.inner.server_streaming(req, path, codec).await
}
}
}