Skip to content

Commit

Permalink
fix(cmux): match grpc if grpc+proto content type
Browse files Browse the repository at this point in the history
`buf curl` sends the content-type as application/grpc+proto and you
cannot change it. This gets interpreted as HTTP without this fix.
  • Loading branch information
Edholm committed Jun 20, 2023
1 parent 48e2a8f commit 6f302d0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cloudmux/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ func ServeGRPCHTTP(
httpServer *http.Server,
) error {
m := cmux.New(l)
grpcL := m.MatchWithWriters(cmux.HTTP2MatchHeaderFieldSendSettings("content-type", "application/grpc"))
grpcL := m.MatchWithWriters(
cmux.HTTP2MatchHeaderFieldSendSettings("content-type", "application/grpc"),
cmux.HTTP2MatchHeaderFieldSendSettings("content-type", "application/grpc+proto"),
)
httpL := m.Match(cmux.Any())
logger, ok := cloudzap.GetLogger(ctx)
if !ok {
Expand Down

0 comments on commit 6f302d0

Please sign in to comment.