From 8eeab44898dc4f0b8d6ef5f8b0dfbb6bf53394e5 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Fri, 16 Apr 2021 17:04:40 +0300 Subject: [PATCH] minor content-type fixes Signed-off-by: Vasiliy Tolstov --- grpc.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/grpc.go b/grpc.go index 304dafd..4130515 100644 --- a/grpc.go +++ b/grpc.go @@ -259,7 +259,7 @@ func (g *grpcServer) handler(srv interface{}, stream grpc.ServerStream) (err err // timeout for server deadline to, ok := md.Get("timeout") if ok { - md.Del("x-content-type") + md.Del("timeout") } // get content type @@ -549,6 +549,10 @@ func (g *grpcServer) newCodec(ct string) (codec.Codec, error) { g.RLock() defer g.RUnlock() + if idx := strings.IndexRune(ct, ';'); idx >= 0 { + ct = ct[:idx] + } + if c, ok := g.opts.Codecs[ct]; ok { return c, nil }