Skip to content

Commit

Permalink
fix(storage): set invocation headers on xml reads (googleapis#10250)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrennaEpp authored May 24, 2024
1 parent 8c44563 commit c87e1ab
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions storage/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -864,17 +864,18 @@ func (c *httpStorageClient) newRangeReaderXML(ctx context.Context, params *newRa
return nil, err
}

// Set custom headers passed in via the context. This is only required for XML;
// for gRPC & JSON this is handled in the GAPIC and Apiary layers respectively.
ctxHeaders := callctx.HeadersFromContext(ctx)
for k, vals := range ctxHeaders {
for _, v := range vals {
req.Header.Add(k, v)
}
}

reopen := readerReopen(ctx, req.Header, params, s,
func(ctx context.Context) (*http.Response, error) { return c.hc.Do(req.WithContext(ctx)) },
func(ctx context.Context) (*http.Response, error) {
// Set custom headers passed in via the context. This is only required for XML;
// for gRPC & JSON this is handled in the GAPIC and Apiary layers respectively.
ctxHeaders := callctx.HeadersFromContext(ctx)
for k, vals := range ctxHeaders {
for _, v := range vals {
req.Header.Set(k, v)
}
}
return c.hc.Do(req.WithContext(ctx))
},
func() error { return setConditionsHeaders(req.Header, params.conds) },
func() { req.URL.RawQuery = fmt.Sprintf("generation=%d", params.gen) })

Expand All @@ -888,7 +889,6 @@ func (c *httpStorageClient) newRangeReaderXML(ctx context.Context, params *newRa
func (c *httpStorageClient) newRangeReaderJSON(ctx context.Context, params *newRangeReaderParams, s *settings) (r *Reader, err error) {
call := c.raw.Objects.Get(params.bucket, params.object)

setClientHeader(call.Header())
call.Projection("full")

if s.userProject != "" {
Expand Down

0 comments on commit c87e1ab

Please sign in to comment.