Documentation
¶
Overview ¶
Package main 提供 gRPC Web 示例服务
本示例用于验证和测试 gateway 的 gRPC Web 实现
运行方式:
go run ./internal/examples/grpcweb
测试方式:
使用 curl 测试普通 HTTP/JSON: curl -X POST http://localhost:8080/v1/greeter/hello -H "Content-Type: application/json" -d '{"name":"World"}'
使用浏览器打开 http://localhost:8080/ 测试 gRPC Web
使用 curl 测试 gRPC Web: curl -X POST http://localhost:8080/grpcweb.example.v1.GreeterService/SayHello \ -H "Content-Type: application/grpc-web+proto" \ -d $'\x00\x00\x00\x00\x07\x0a\x05World' --output -
Click to show internal directories.
Click to hide internal directories.