grpcweb

command
v2.0.0-beta.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package main 提供 gRPC Web 示例服务

本示例用于验证和测试 gateway 的 gRPC Web 实现

运行方式:

go run ./internal/examples/grpcweb

测试方式:

  1. 使用 curl 测试普通 HTTP/JSON: curl -X POST http://localhost:8080/v1/greeter/hello -H "Content-Type: application/json" -d '{"name":"World"}'

  2. 使用浏览器打开 http://localhost:8080/ 测试 gRPC Web

  3. 使用 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 -

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL