From 3c7c499cefb3fb46d0c662bcf296408a66fc5acc Mon Sep 17 00:00:00 2001 From: Ziyi Yan Date: Fri, 31 Jul 2020 16:12:55 +0800 Subject: [PATCH] Only canonicalize header key once in each iteration (#1564) --- runtime/context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/context.go b/runtime/context.go index a2d7a5e7c55..39e2a987460 100644 --- a/runtime/context.go +++ b/runtime/context.go @@ -93,8 +93,8 @@ func annotateContext(ctx context.Context, mux *ServeMux, req *http.Request) (con } for key, vals := range req.Header { + key = textproto.CanonicalMIMEHeaderKey(key) for _, val := range vals { - key = textproto.CanonicalMIMEHeaderKey(key) // For backwards-compatibility, pass through 'authorization' header with no prefix. if key == "Authorization" { pairs = append(pairs, "authorization", val)