From e77a5dac7bc282cd51120ac4ed53d3b9e43a83d6 Mon Sep 17 00:00:00 2001 From: Julio Guerra Date: Mon, 4 Feb 2019 11:43:11 +0100 Subject: [PATCH] Fix StreamServerInterceptor doc example Fix the example showing how to store a value into a stream context: - get the stream context out of the stream object. - pass the newly created wrapped stream to the handler. --- doc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc.go b/doc.go index 716895036..e7f782a2d 100644 --- a/doc.go +++ b/doc.go @@ -62,8 +62,8 @@ needed. For example: func FakeAuthStreamingInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { newStream := grpc_middleware.WrapServerStream(stream) - newStream.WrappedContext = context.WithValue(ctx, "user_id", "john@example.com") - return handler(srv, stream) + newStream.WrappedContext = context.WithValue(stream.Context(), "user_id", "john@example.com") + return handler(srv, newStream) } */ package grpc_middleware