wolflex888 commented on code in PR #12595: URL: https://github.com/apache/iceberg/pull/12595#discussion_r2019026961
########## core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java: ########## @@ -332,6 +336,41 @@ public void testInitializeWithBadArguments() throws IOException { restCat.close(); } + @Test + public void testDefaultHeadersPropagated() { + Map<String, String> catalogHeaders = + ImmutableMap.of("Authorization", "Bearer client-credentials-token:sub=catalog"); + + Map<String, String> properties = + ImmutableMap.of( + "test-header", "test-value", CatalogProperties.URI, httpServer.getURI().toString()); + Map<String, String> expectedHeaders = ImmutableMap.of("test-header", "test-value"); + HTTPClient client = + Mockito.spy( + HTTPClient.builder(properties) + .withHeaders(RESTUtil.merge(RESTUtil.configHeaders(properties), catalogHeaders)) + .uri(properties.get(CatalogProperties.URI)) + .build()); + RESTCatalog catalog = + new RESTCatalog(SessionCatalog.SessionContext.createEmpty(), (config) -> client); Review Comment: Sorry for being slow, but how do we usually deal with this kind of situation? Normally, `clientBuilder` will build a new HttpClient for us to use, but in this case we are returning a static client. We can't do `Mokito.spy` unless it's static. -- 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