adutra commented on code in PR #12595:
URL: https://github.com/apache/iceberg/pull/12595#discussion_r2018738191


##########
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:
   It will be closed by this try-with-resources block when `initialize` is 
called:
   
   
https://github.com/apache/iceberg/blob/3d95a69b880e9ff52bfbd2c92ee24a012257737c/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java#L201



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

Reply via email to