-
Notifications
You must be signed in to change notification settings - Fork 139
feat(catalog): add WithHeaders function #652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -593,6 +593,17 @@ 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()) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it desirable to be able to override this as well?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yea good point. for python, we allow overriding
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the order currently would not allow |
||
| if session.defaultHeaders.Get("X-Iceberg-Access-Delegation") == "" { | ||
| session.defaultHeaders.Set("X-Iceberg-Access-Delegation", "vended-credentials") | ||
| } | ||
|
|
||
| token := opts.oauthToken | ||
| if token == "" && opts.credential != "" { | ||
| var err error | ||
|
|
@@ -605,11 +616,6 @@ func (r *Catalog) createSession(ctx context.Context, opts *options) (*http.Clien | |
| session.defaultHeaders.Set(authorizationHeader, bearerPrefix+" "+token) | ||
| } | ||
|
|
||
| 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") | ||
|
|
||
| if opts.enableSigv4 { | ||
| cfg := opts.awsConfig | ||
| if !opts.awsConfigSet { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.