gRPC 命令行客户端,支持反射和 proto 文件
grpcurl 可以列出服务、描述方法、调用 unary/streaming RPC。服务端启用 reflection 时无需本地 proto;否则要用 -proto/-import-path 指定定义。
grpcurl -plaintext localhost:50051 list
grpcurl -plaintext localhost:50051 describe helloworld.Greeter
grpcurl -plaintext -d '{"name":"world"}' localhost:50051 helloworld.Greeter/SayHello
grpcurl -import-path ./proto -proto helloworld.proto -plaintext localhost:50051 list
list 会失败;改用 -proto + -import-path。-plaintext 只用于无 TLS 的测试环境;生产要配置证书/-insecure 仅限测试。-d @ 从 stdin 传多段 JSON。-H 'authorization: Bearer ...';不要把 token 写进 shell 历史。