From 9170371647aae80424812d4d1524b645310ca683 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Wed, 23 Aug 2023 16:32:14 +0300 Subject: [PATCH] insert request id in context Signed-off-by: Vasiliy Tolstov --- requestid.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requestid.go b/requestid.go index e4be5c5..72f2593 100644 --- a/requestid.go +++ b/requestid.go @@ -40,10 +40,11 @@ var DefaultMetadataFunc = func(ctx context.Context) (context.Context, error) { } imd.Set(DefaultMetadataKey, v) omd.Set(DefaultMetadataKey, v) + ctx = context.WithValue(ctx, XRequestIDKey, v) ctx = metadata.NewIncomingContext(ctx, imd) ctx = metadata.NewOutgoingContext(ctx, omd) - return context.WithValue(ctx, XRequestIDKey, v), nil + return ctx, nil } type wrapper struct { -- 2.45.2