Skip to content

Commit

Permalink
fix(gengapic): inject gRPC server stream call opts (#1202)
Browse files Browse the repository at this point in the history
  • Loading branch information
noahdietz authored Dec 19, 2022
1 parent 23ce8d5 commit 1b93213
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/gengapic/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func (g *generator) serverStreamCall(servName string, s *descriptor.ServiceDescr
lowcaseServName, m.GetName(), inSpec.Name, inType.GetName(), servSpec.Name, s.GetName(), m.GetName())

g.insertRequestHeaders(m, grpc)
g.appendCallOpts(m)

p(" var resp %s.%s_%sClient", servSpec.Name, s.GetName(), m.GetName())
p("err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {")
Expand Down
1 change: 1 addition & 0 deletions internal/gengapic/testdata/method_ServerThings.want
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ func (c *fooGRPCClient) ServerThings(ctx context.Context, req *mypackagepb.Input
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v&%s=%v&%s=%v&%s=%v", "field_name.nested", url.QueryEscape(req.GetFieldName().GetNested()), "other", url.QueryEscape(req.GetOther()), "another", url.QueryEscape(req.GetAnother()), "biz", url.QueryEscape(fmt.Sprintf("%g", req.GetBiz())), "top_level_enum", mypackagepb.TopLevelEnum_name[int32(req.GetTopLevelEnum())], "nested_enum", mypackagepb.InputType_NestedEnum_name[int32(req.GetNestedEnum())]))

ctx = insertMetadata(ctx, c.xGoogMetadata, md)
opts = append((*c.CallOptions).ServerThings[0:len((*c.CallOptions).ServerThings):len((*c.CallOptions).ServerThings)], opts...)
var resp mypackagepb.Foo_ServerThingsClient
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
var err error
Expand Down

0 comments on commit 1b93213

Please sign in to comment.