This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch gh-pages
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git
The following commit(s) were added to refs/heads/gh-pages by this push:
new 6dd39fa6 deploy: f0295f80a1fa5ae0d9be17fac5e4a973dcfde638
6dd39fa6 is described below
commit 6dd39fa62f35ae855ca06ce49fc1e69a6041f7b9
Author: Xuanwo <[email protected]>
AuthorDate: Wed Mar 19 03:19:50 2025 +0000
deploy: f0295f80a1fa5ae0d9be17fac5e4a973dcfde638
---
api/src/iceberg_catalog_rest/client.rs.html | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/api/src/iceberg_catalog_rest/client.rs.html
b/api/src/iceberg_catalog_rest/client.rs.html
index 8fd1f4ce..2e2470fc 100644
--- a/api/src/iceberg_catalog_rest/client.rs.html
+++ b/api/src/iceberg_catalog_rest/client.rs.html
@@ -256,6 +256,12 @@
<a href="#256" id="256">256</a>
<a href="#257" id="257">257</a>
<a href="#258" id="258">258</a>
+<a href="#259" id="259">259</a>
+<a href="#260" id="260">260</a>
+<a href="#261" id="261">261</a>
+<a href="#262" id="262">262</a>
+<a href="#263" id="263">263</a>
+<a href="#264" id="264">264</a>
</pre></div><pre class="rust"><code><span class="comment">// Licensed to the
Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
@@ -315,12 +321,15 @@
<span class="kw">impl </span>HttpClient {
<span class="doccomment">/// Create a new http client.
</span><span class="kw">pub fn </span>new(cfg: <span
class="kw-2">&</span>RestCatalogConfig) -> <span
class="prelude-ty">Result</span><<span class="self">Self</span>> {
+ <span class="kw">let </span>extra_headers = cfg.extra_headers()<span
class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(HttpClient {
- client: Client::new(),
+ client: Client::builder()
+ .default_headers(extra_headers.clone())
+ .build()<span class="question-mark">?</span>,
token: Mutex::new(cfg.token()),
token_endpoint: cfg.get_token_endpoint(),
credential: cfg.credential(),
- extra_headers: cfg.extra_headers()<span
class="question-mark">?</span>,
+ extra_headers,
extra_oauth_params: cfg.extra_oauth_params(),
})
}
@@ -330,8 +339,14 @@
/// If cfg carries new value, we will use cfg instead.
/// Otherwise, we will keep the old value.
</span><span class="kw">pub fn </span>update_with(<span
class="self">self</span>, cfg: <span
class="kw-2">&</span>RestCatalogConfig) -> <span
class="prelude-ty">Result</span><<span class="self">Self</span>> {
+ <span class="kw">let </span>extra_headers = (!cfg.extra_headers()<span
class="question-mark">?</span>.is_empty())
+ .then(|| cfg.extra_headers())
+ .transpose()<span class="question-mark">?
+ </span>.unwrap_or(<span class="self">self</span>.extra_headers);
<span class="prelude-val">Ok</span>(HttpClient {
- client: <span class="self">self</span>.client,
+ client: Client::builder()
+ .default_headers(extra_headers.clone())
+ .build()<span class="question-mark">?</span>,
token: Mutex::new(
cfg.token()
.or_else(|| <span
class="self">self</span>.token.into_inner().ok().flatten()),
@@ -340,10 +355,7 @@
.then(|| cfg.get_token_endpoint())
.unwrap_or(<span class="self">self</span>.token_endpoint),
credential: cfg.credential().or(<span
class="self">self</span>.credential),
- extra_headers: (!cfg.extra_headers()<span
class="question-mark">?</span>.is_empty())
- .then(|| cfg.extra_headers())
- .transpose()<span class="question-mark">?
- </span>.unwrap_or(<span
class="self">self</span>.extra_headers),
+ extra_headers,
extra_oauth_params: (!cfg.extra_oauth_params().is_empty())
.then(|| cfg.extra_oauth_params())
.unwrap_or(<span class="self">self</span>.extra_oauth_params),