grpcurl
grpcurl copied to clipboard
support generate method invoke template
trafficstars
Although we can compse request param step by step,it would be more convenient if grpcurl can generate it automately.
traditionally
step 1
➜ ~ grpcurl localhost:20789 describe grpc.health.v1.Health.Check
grpc.health.v1.Health.Check is a method:
rpc Check ( .grpc.health.v1.HealthCheckRequest ) returns ( .grpc.health.v1.HealthCheckResponse );
➜ ~ grpcurl localhost:20789 describe .grpc.health.v1.HealthCheckRequest
grpc.health.v1.HealthCheckRequest is a message:
message HealthCheckRequest {
string service = 1;
}
then make the request json, and invoke :
➜ ~ grpcurl -d '{"service": "test"}' localhost:20789 grpc.health.v1.Health/Check
{
"status": "SERVING",
"idle": 0.5,
"max_thread_count": 24
}
newly
Suppose we support template command, and template will generate a invoke template
➜ ~ grpcurl localhost:20789 template grpc.health.v1.Health.Check
grpcurl -d '{"service": "test"}' localhost:20789 grpc.health.v1.Health/Check