Skip to content

Commit

Permalink
Update streaming interceptor example (#320)
Browse files Browse the repository at this point in the history
Return new stream with wrapped context instead of original so changes will be passed further the chain
  • Loading branch information
Konstantin Azizov committed Jul 24, 2020
1 parent a452205 commit 7a5efaa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ 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)
return handler(srv, newStream)
}
*/
package grpc_middleware

0 comments on commit 7a5efaa

Please sign in to comment.