From a26b37aaf996af05acd1be35e677ba482331eb06 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Sun, 12 Apr 2020 11:16:08 +0100 Subject: [PATCH] Strip MetadataKey global var --- rpc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpc.go b/rpc.go index 980333b..7c06b66 100644 --- a/rpc.go +++ b/rpc.go @@ -118,7 +118,7 @@ func (h *rpcHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { // create context cx := ctx.FromRequest(r) // get context from http handler wrappers - md, ok := r.Context().Value(metadata.MetadataKey{}).(metadata.Metadata) + md, ok := metadata.FromContext(r.Context()) if !ok { md = make(metadata.Metadata) } @@ -293,7 +293,7 @@ func requestPayload(r *http.Request) ([]byte, error) { // otherwise as per usual ctx := r.Context() // dont user meadata.FromContext as it mangles names - md, ok := ctx.Value(metadata.MetadataKey{}).(metadata.Metadata) + md, ok := metadata.FromContext(ctx) if !ok { md = make(map[string]string) }