diff --git a/pubsub/pullstream.go b/pubsub/pullstream.go index d6f5eb636e5c..bfdc11e2a02e 100644 --- a/pubsub/pullstream.go +++ b/pubsub/pullstream.go @@ -16,7 +16,9 @@ package pubsub import ( "context" + "fmt" "io" + "net/url" "sync" "time" @@ -42,6 +44,8 @@ type streamingPullFunc func(context.Context, ...gax.CallOption) (pb.Subscriber_S func newPullStream(ctx context.Context, streamingPull streamingPullFunc, subName string, maxOutstandingMessages, maxOutstandingBytes int, maxDurationPerLeaseExtension time.Duration) *pullStream { ctx = withSubscriptionKey(ctx, subName) + hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "subscription", url.QueryEscape(subName))} + ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) ctx, cancel := context.WithCancel(ctx) return &pullStream{ ctx: ctx,