Revanth14 commented on code in PR #1324:
URL: https://github.com/apache/iceberg-go/pull/1324#discussion_r3496602657
##########
catalog/rest/rest.go:
##########
@@ -389,6 +440,24 @@ func doPostAllowNoContent[Payload, Result any](ctx
context.Context, baseURI *url
return ret, err
}
+func setRequestHeaders(req *http.Request, headers map[string]string) {
+ for k, v := range headers {
+ req.Header.Set(k, v)
+ }
+}
+
+// suppressRequestHeaders prevents the named session-default headers from being
+// sent on this request. It writes a present-but-empty header entry rather than
+// calling Header.Del: sessionTransport.RoundTrip decides whether to apply a
+// default by testing key *presence* (not value), so a present-but-empty key
+// both blocks the default and emits nothing, whereas deleting the key would
let
+// the default reappear. Keep RoundTrip's presence check in sync with this.
+func suppressRequestHeaders(req *http.Request, headers []string) {
+ for _, h := range headers {
+ req.Header[http.CanonicalHeaderKey(h)] = nil
Review Comment:
Went with the sturdier version here.
The nil-slice suppression path was removed entirely. Suppression is now
carried as an explicit canonicalized set on the request context, and
`RoundTrip` consults that set directly when applying session defaults. That
removes the dependency on net/http’s nil-slice behavior and also removes the
two-sided “keep this in sync” invariant.
I added direct coverage for the three default-header paths: apply default
when absent, let a real per-request header override without duplication, and
suppress a default via context.
--
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]