huan233usc commented on code in PR #2692:
URL: https://github.com/apache/iceberg-rust/pull/2692#discussion_r3494062645


##########
crates/catalog/rest/src/catalog.rs:
##########
@@ -412,14 +417,41 @@ impl RestCatalog {
             .get_or_try_init(|| async {
                 let client = HttpClient::new(&self.user_config)?;
                 let catalog_config = RestCatalog::load_config(&client, 
&self.user_config).await?;
+                // The `endpoints` field is optional. An absent field (`None`)
+                // means an older server, so fall back to the standard base 
set;
+                // an explicit list — even an empty one — is taken verbatim.
+                let endpoints = match &catalog_config.endpoints {
+                    Some(advertised) => advertised.iter().cloned().collect(),
+                    None => crate::endpoint::DEFAULT_ENDPOINTS.clone(),
+                };
                 let config = 
self.user_config.clone().merge_with_config(catalog_config);
                 let client = client.update_with(&config)?;
 
-                Ok(RestContext { config, client })
+                Ok(RestContext {
+                    config,
+                    client,
+                    endpoints,
+                })
             })
             .await
     }
 
+    /// Returns whether the connected server supports `endpoint`.
+    ///
+    /// Servers advertise the routes they support in the `endpoints` field of
+    /// the `GET /v1/config` response. When that field is present it is used
+    /// verbatim (an explicit empty list therefore advertises nothing). When a

Review Comment:
   Makes sense — buggy servers sending empty lists is the realistic case. 
Switched to falling back to the default set for an explicit empty list too 
(Java's RESTSessionCatalog treats empty the same via isEmpty()).



-- 
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]

Reply via email to