whynick1 commented on code in PR #306: URL: https://github.com/apache/iceberg-rust/pull/306#discussion_r1538626596
########## crates/catalog/rest/src/catalog.rs: ########## @@ -130,6 +130,33 @@ impl RestCatalogConfig { ); } + for (key, value) in self.props.iter() { + if let Some(stripped_key) = key.strip_prefix("header.") { + headers.insert( + HeaderName::from_str(stripped_key).map_err(|e| { + Error::new( + ErrorKind::DataInvalid, + format!("Invalid header name: {stripped_key}!"), + ) + .with_source(e) + })?, + HeaderValue::from_str(value).map_err(|e| { + Error::new( + ErrorKind::DataInvalid, + format!("Invalid header value: {value}!"), + ) + .with_source(e) + })?, + ); + } + } + Ok(headers) + } + + fn try_create_rest_client(&self) -> Result<HttpClient> { + // TODO: We will add ssl config, sigv4 later + let headers = self.get_default_headers()?; Review Comment: Refactor code into a new function `get_default_headers` for easier unit testing. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org