import java.net.URI;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
HashMap<String, String> headers = new HashMap<>();
headers.put("Cookie", "someTokenValue=23gBog34");
headers.put("AnotherKey", "someValue");
- ((TransportHttp) t).setAdditionalHeaders(headers);
+
+ @SuppressWarnings("resource")
+ TransportHttp th = (TransportHttp) t;
+ th.setAdditionalHeaders(headers);
t.openFetch();
+
+ Map<String, String> h = th.getAdditionalHeaders();
+ assertEquals("someTokenValue=23gBog34", h.get("Cookie"));
+ assertEquals("someValue", h.get("AnotherKey"));
}
List<AccessEvent> requests = getRequests();
this.headers = headers;
}
+ /**
+ * Get additional headers on the HTTP connection
+ *
+ * @return unmodifiable map of additional name:values that are set as
+ * headers on the HTTP connection
+ * @since 6.6
+ */
+ public Map<String, String> getAdditionalHeaders() {
+ return Collections.unmodifiableMap(headers);
+ }
+
private NoRemoteRepositoryException createNotFoundException(URIish u,
URL url, String msg) {
String text;