kevinjqliu commented on code in PR #652:
URL: https://github.com/apache/iceberg-go/pull/652#discussion_r2674568148
##########
catalog/rest/rest.go:
##########
@@ -593,6 +593,15 @@ func (r *Catalog) createSession(ctx context.Context, opts
*options) (*http.Clien
}
cl := &http.Client{Transport: session}
+ for k, v := range opts.headers {
+ session.defaultHeaders.Set(k, v)
+ }
+
+ session.defaultHeaders.Set("X-Client-Version", icebergRestSpecVersion)
+ session.defaultHeaders.Set("Content-Type", "application/json")
+ session.defaultHeaders.Set("User-Agent", "GoIceberg/"+iceberg.Version())
Review Comment:
yea good point. for python, we allow overriding
`X-Iceberg-Access-Delegation` but not `User-Agent` and `Content-Type`.
https://github.com/apache/iceberg-python/blob/3855f64b2ef5552483c377abeed95d2b9872777b/pyiceberg/catalog/rest/__init__.py#L615-L620
##########
catalog/rest/rest.go:
##########
@@ -593,6 +593,15 @@ func (r *Catalog) createSession(ctx context.Context, opts
*options) (*http.Clien
}
cl := &http.Client{Transport: session}
+ for k, v := range opts.headers {
+ session.defaultHeaders.Set(k, v)
+ }
+
+ session.defaultHeaders.Set("X-Client-Version", icebergRestSpecVersion)
+ session.defaultHeaders.Set("Content-Type", "application/json")
+ session.defaultHeaders.Set("User-Agent", "GoIceberg/"+iceberg.Version())
Review Comment:
the order currently would not allow `User-Agent` to be overridden. I think
thats the right behavior
##########
catalog/rest/rest.go:
##########
@@ -593,6 +593,15 @@ func (r *Catalog) createSession(ctx context.Context, opts
*options) (*http.Clien
}
cl := &http.Client{Transport: session}
+ for k, v := range opts.headers {
+ session.defaultHeaders.Set(k, v)
+ }
+
+ session.defaultHeaders.Set("X-Client-Version", icebergRestSpecVersion)
+ session.defaultHeaders.Set("Content-Type", "application/json")
+ session.defaultHeaders.Set("User-Agent", "GoIceberg/"+iceberg.Version())
+ session.defaultHeaders.Set("X-Iceberg-Access-Delegation",
"vended-credentials")
Review Comment:
```suggestion
if session.defaultHeaders.Get("X-Iceberg-Access-Delegation") == "" {
session.defaultHeaders.Set("X-Iceberg-Access-Delegation",
"vended-credentials")
}
```
only set again here if not already exist
--
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]