Skip to content

Commit c87e1ab

Browse files
authored
fix(storage): set invocation headers on xml reads (#10250)
1 parent 8c44563 commit c87e1ab

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

storage/http_client.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -864,17 +864,18 @@ func (c *httpStorageClient) newRangeReaderXML(ctx context.Context, params *newRa
864864
return nil, err
865865
}
866866

867-
// Set custom headers passed in via the context. This is only required for XML;
868-
// for gRPC & JSON this is handled in the GAPIC and Apiary layers respectively.
869-
ctxHeaders := callctx.HeadersFromContext(ctx)
870-
for k, vals := range ctxHeaders {
871-
for _, v := range vals {
872-
req.Header.Add(k, v)
873-
}
874-
}
875-
876867
reopen := readerReopen(ctx, req.Header, params, s,
877-
func(ctx context.Context) (*http.Response, error) { return c.hc.Do(req.WithContext(ctx)) },
868+
func(ctx context.Context) (*http.Response, error) {
869+
// Set custom headers passed in via the context. This is only required for XML;
870+
// for gRPC & JSON this is handled in the GAPIC and Apiary layers respectively.
871+
ctxHeaders := callctx.HeadersFromContext(ctx)
872+
for k, vals := range ctxHeaders {
873+
for _, v := range vals {
874+
req.Header.Set(k, v)
875+
}
876+
}
877+
return c.hc.Do(req.WithContext(ctx))
878+
},
878879
func() error { return setConditionsHeaders(req.Header, params.conds) },
879880
func() { req.URL.RawQuery = fmt.Sprintf("generation=%d", params.gen) })
880881

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

891-
setClientHeader(call.Header())
892892
call.Projection("full")
893893

894894
if s.userProject != "" {

0 commit comments

Comments
 (0)