18 lines
507 B
Rust
18 lines
507 B
Rust
use grpc_web_client::Client as GrpcWebClient;
|
|
|
|
tonic::include_proto!("hello");
|
|
|
|
use crate::grpc::hello_world_client::HelloWorldClient;
|
|
|
|
async fn test_grpc_web() {
|
|
let client = GrpcWebClient::new("http://localhost:10000".to_string());
|
|
let mut client = HelloWorldClient::new(client);
|
|
|
|
let request = tonic::Request::new(HelloRequest {
|
|
name: "WebTonic".into(),
|
|
});
|
|
|
|
let response = client.say_hello(request).await.unwrap().into_inner();
|
|
println!("Hello reply: {:?}", response);
|
|
}
|