Revanth14 commented on code in PR #1324:
URL: https://github.com/apache/iceberg-go/pull/1324#discussion_r3573216143
##########
catalog/rest/rest.go:
##########
@@ -222,10 +228,17 @@ type sessionTransport struct {
const emptyStringHash =
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
func (s *sessionTransport) RoundTrip(r *http.Request) (*http.Response, error) {
+ // A session default is applied unless the request already carries that
+ // header (a per-request override of any default, not just Content-Type
+ // wins) or explicitly opted out of it via withSuppressedHeaders
(carried on
+ // the context as an explicit set, never inferred from header values).
+ suppressed := suppressedHeadersFrom(r.Context())
for k, v := range s.defaultHeaders {
- // Skip Content-Type if it's already set in the request
- // to avoid duplicate headers (e.g., when using PostForm)
- if http.CanonicalHeaderKey(k) == "Content-Type" &&
r.Header.Get("Content-Type") != "" {
+ ck := http.CanonicalHeaderKey(k)
+ if _, ok := r.Header[ck]; ok {
Review Comment:
Addressed. Added a load-bearing ordering comment documenting that
`authManager` must run after the default-header loop and overwrite any
caller-supplied `Authorization` value.
Also added a regression test confirming that `authManager.AuthHeader()` wins
over a per-request `Authorization` header.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]