Revanth14 commented on code in PR #1324:
URL: https://github.com/apache/iceberg-go/pull/1324#discussion_r3496626583
##########
catalog/rest/rest.go:
##########
@@ -223,9 +229,11 @@ const emptyStringHash =
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991
func (s *sessionTransport) RoundTrip(r *http.Request) (*http.Response, error) {
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") != "" {
+ // Per-request headers override session defaults. The check is
on key
+ // *presence*, not value, so suppressRequestHeaders can opt out
of a
+ // default by setting a present-but-empty entry. Keep this in
sync with
+ // suppressRequestHeaders.
+ if _, ok := r.Header[http.CanonicalHeaderKey(k)]; ok {
Review Comment:
Addressed in the `RoundTrip` comment.
It now explicitly states that a session default is skipped when the request
already carries the same header key, and that this applies to any per-request
override, not just `Content-Type`. The old Content-Type special case is now
covered by the general rule, and suppression is handled separately through the
context-carried suppression set.
--
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]