Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion xds/internal/clients/grpctransport/grpc_transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (

"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/encoding/proto"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/keepalive"
"google.golang.org/grpc/xds/internal/clients"
Expand Down Expand Up @@ -211,6 +212,8 @@ func (s *stream) Recv() ([]byte, error) {
return typedRes, nil
}

// byteCodec here is still sending proto messages. It's just they are
// in []byte form.
type byteCodec struct{}

func (c *byteCodec) Marshal(v any) ([]byte, error) {
Expand All @@ -229,5 +232,7 @@ func (c *byteCodec) Unmarshal(data []byte, v any) error {
}

func (c *byteCodec) Name() string {
return "grpctransport.byteCodec"
// Return "proto" to ensure the Content-Type header is "application/grpc",
// which is expected by standard gRPC servers for protobuf messages.
return proto.Name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just "proto" please.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}