Test gRPC services with gRPCurl

Test gRPC services with gRPCurl

The gRPC functions can only be called by gRPC clients. My team just started migrating to gRPC stack, and I found gRPCCurl is a very helpful CLI tool to test and debug.

Installation

brew install…


This content originally appeared on DEV Community and was authored by DEV Community

Test gRPC services with gRPCurl

The gRPC functions can only be called by gRPC clients. My team just started migrating to gRPC stack, and I found gRPCCurl is a very helpful CLI tool to test and debug.

Installation

brew install grpcurl

Usage

Start your gRPC service and check the service metadata. My service is running on port of 10030.

Use "-plaintext" if your service does not use TLS.

grpcurl -plaintext localhost:10030 describe
grpc.health.v1.Health is a service:
service Health {
  rpc Check ( .grpc.health.v1.HealthCheckRequest ) returns ( .grpc.health.v1.HealthCheckResponse );
  rpc Watch ( .grpc.health.v1.HealthCheckRequest ) returns ( stream .grpc.health.v1.HealthCheckResponse );
}
grpc.reflection.v1alpha.ServerReflection is a service:
service ServerReflection {
  rpc ServerReflectionInfo ( stream .grpc.reflection.v1alpha.ServerReflectionRequest ) returns ( stream .grpc.reflection.v1alpha.ServerReflectionResponse );
}
sample_module.sample_package.SayHi is a service:
service SayHi {
  rpc SayHello ( .sample_module.sample_package.HelloRequest ) returns ( .sample_module.sample_package.HelloReply );
}

Call sample_module.sample_package.SayHi service.

grpcurl -d '{"msg": "jimmy"}' -plaintext localhost:10030 sample_module.sample_package.SayHi/SayHello
{
  "msg": "SayHijimmy",
  "code": "1"
}


This content originally appeared on DEV Community and was authored by DEV Community


Print Share Comment Cite Upload Translate Updates
APA

DEV Community | Sciencx (2022-03-16T03:33:19+00:00) Test gRPC services with gRPCurl. Retrieved from https://www.scien.cx/2022/03/16/test-grpc-services-with-grpcurl/

MLA
" » Test gRPC services with gRPCurl." DEV Community | Sciencx - Wednesday March 16, 2022, https://www.scien.cx/2022/03/16/test-grpc-services-with-grpcurl/
HARVARD
DEV Community | Sciencx Wednesday March 16, 2022 » Test gRPC services with gRPCurl., viewed ,<https://www.scien.cx/2022/03/16/test-grpc-services-with-grpcurl/>
VANCOUVER
DEV Community | Sciencx - » Test gRPC services with gRPCurl. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/03/16/test-grpc-services-with-grpcurl/
CHICAGO
" » Test gRPC services with gRPCurl." DEV Community | Sciencx - Accessed . https://www.scien.cx/2022/03/16/test-grpc-services-with-grpcurl/
IEEE
" » Test gRPC services with gRPCurl." DEV Community | Sciencx [Online]. Available: https://www.scien.cx/2022/03/16/test-grpc-services-with-grpcurl/. [Accessed: ]
rf:citation
» Test gRPC services with gRPCurl | DEV Community | Sciencx | https://www.scien.cx/2022/03/16/test-grpc-services-with-grpcurl/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.