Skip to content

Commit

Permalink
Merge pull request #58855 from knz/20210112-revert-facepalm202
Browse files Browse the repository at this point in the history
release-20.2: Revert "server: remove support for binary protobuf payloads in the HTTP endpoints
  • Loading branch information
knz authored Jan 12, 2021
2 parents 91e4d8a + f9ed43b commit 6528ec9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Expand Down
4 changes: 4 additions & 0 deletions pkg/util/httputil/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 6528ec9

Please sign in to comment.