diff --git a/transport/http_util.go b/transport/http_util.go index ac3c4755..281819c7 100644 --- a/transport/http_util.go +++ b/transport/http_util.go @@ -140,6 +140,11 @@ func newHPACKDecoder() *hpackDecoder { d := &hpackDecoder{} d.h = hpack.NewDecoder(http2InitHeaderTableSize, func(f hpack.HeaderField) { switch f.Name { + case "content-type": + if !strings.Contains(f.Value, "application/grpc") { + d.err = StreamErrorf(codes.FailedPrecondition, "transport: received the unexpected header") + return + } case "grpc-status": code, err := strconv.Atoi(f.Value) if err != nil {