diff --git a/pkg/server/server.go b/pkg/server/server.go index e515f9440109..fbef9d4a3e73 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -1182,10 +1182,13 @@ func (s *Server) Start(ctx context.Context) error { EmitDefaults: true, Indent: " ", } + protopb := new(protoutil.ProtoPb) gwMux := gwruntime.NewServeMux( gwruntime.WithMarshalerOption(gwruntime.MIMEWildcard, jsonpb), gwruntime.WithMarshalerOption(httputil.JSONContentType, jsonpb), gwruntime.WithMarshalerOption(httputil.AltJSONContentType, jsonpb), + gwruntime.WithMarshalerOption(httputil.ProtoContentType, protopb), + gwruntime.WithMarshalerOption(httputil.AltProtoContentType, protopb), gwruntime.WithOutgoingHeaderMatcher(authenticationHeaderMatcher), gwruntime.WithMetadata(forwardAuthenticationMetadata), ) diff --git a/pkg/util/httputil/http.go b/pkg/util/httputil/http.go index fcd9f7a94387..fd02d3030b71 100644 --- a/pkg/util/httputil/http.go +++ b/pkg/util/httputil/http.go @@ -34,6 +34,10 @@ const ( JSONContentType = "application/json" // AltJSONContentType is the alternate JSON content type. AltJSONContentType = "application/x-json" + // ProtoContentType is the protobuf content type. + ProtoContentType = "application/x-protobuf" + // AltProtoContentType is the alternate protobuf content type. + AltProtoContentType = "application/x-google-protobuf" // PlaintextContentType is the plaintext content type. PlaintextContentType = "text/plain" // GzipEncoding is the gzip encoding.