Skip to content

Commit

Permalink
Merge #58856
Browse files Browse the repository at this point in the history
58856: Revert "server: remove support for binary protobuf payloads in the HTTP endpoints" r=tbg a=knz

This reverts commit c5eae6a.



Co-authored-by: Raphael 'kena' Poss <knz@thaumogen.net>
  • Loading branch information
craig[bot] and knz committed Jan 12, 2021
2 parents 63fba7f + e86c358 commit c59bcc6
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 @@ -1237,10 +1237,13 @@ func (s *Server) PreStart(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 c59bcc6

Please sign in to comment.