Skip to content

Commit

Permalink
don't forget vanguardgrpc package
Browse files Browse the repository at this point in the history
  • Loading branch information
jhump committed Oct 11, 2023
1 parent 5be0d8e commit 0898bae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions internal/examples/connect+grpc/cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ func main() {
server := grpc.NewServer()
elizav1grpc.RegisterElizaServiceServer(server, elizaImpl{})

// Now wrap it with a Vanguard handler to upgrade it to
// Now wrap it with a Vanguard transcoder to upgrade it to
// also supporting Connect and gRPC-Web (and even REST,
// if the gRPC service schemas have HTTP annotations).
handler, err := vanguardgrpc.NewHandler(server)
handler, err := vanguardgrpc.NewTranscoder(server)
if err != nil {
_, _ = fmt.Fprintln(os.Stderr, err)
os.Exit(1)
Expand Down
4 changes: 2 additions & 2 deletions vanguardgrpc/vanguardgrpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"google.golang.org/protobuf/proto"
)

// NewHandler returns a Vanguard handler that wraps the given gRPC server. All
// NewTranscoder returns a Vanguard handler that wraps the given gRPC server. All
// services registered with the server will be supported by the returned handler.
// The Vanguard handler will be configured to transcode incoming requests to the
// gRPC protocol.
Expand All @@ -50,7 +50,7 @@ import (
// DiscardUnknown: true,
// },
// })
func NewHandler(server *grpc.Server, opts ...vanguard.TranscoderOption) (http.Handler, error) {
func NewTranscoder(server *grpc.Server, opts ...vanguard.TranscoderOption) (http.Handler, error) {
codecs := make([]string, 1, 2)
codecs[0] = vanguard.CodecProto
if encoding.GetCodec(vanguard.CodecJSON) != nil {
Expand Down
4 changes: 2 additions & 2 deletions vanguardgrpc/vanguardgrpc_examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"google.golang.org/protobuf/types/known/timestamppb"
)

func ExampleNewHandler_connectToGRPC() {
func ExampleNewTranscoder_connectToGRPC() {
log := log.New(os.Stdout, "" /* prefix */, 0 /* flags */)

// Configure gRPC servers to support JSON.
Expand All @@ -47,7 +47,7 @@ func ExampleNewHandler_connectToGRPC() {
testv1.RegisterLibraryServiceServer(grpcServer, svc)

// Create a vanguard handler for all services registered in grpcServer
handler, err := vanguardgrpc.NewHandler(grpcServer)
handler, err := vanguardgrpc.NewTranscoder(grpcServer)
if err != nil {
log.Println("error:", err)
return
Expand Down

0 comments on commit 0898bae

Please sign in to comment.