Service Inspection with grpcurl
This guide explains how to inspect and test your gRPC services with grpcurl in a Sword application.
For .proto contract design recommendations, see .proto Files.
Minimum requirements
- Have
grpcurlinstalled. - Have at least one registered gRPC controller.
- Enable reflection in the configuration:
toml
[grpc]
enable-tonic-reflection = trueReflection is registered from build.rs
For reflection to expose your services and types, your build.rs must generate sword_descriptor_set.bin in OUT_DIR. See Compiling Protos.
Basic grpcurl commands
Assuming a server at 127.0.0.1:50051:
List services
bash
grpcurl -plaintext 127.0.0.1:50051 listDescribe a service
bash
grpcurl -plaintext 127.0.0.1:50051 describe users.UserServiceGlobal health check
bash
grpcurl -plaintext -d '{"service":""}' 127.0.0.1:50051 grpc.health.v1.Health/CheckRun a method with metadata
bash
grpcurl -plaintext -H 'authorization: bearer test' -d '{}' 127.0.0.1:50051 users.UserService/ListUsers
