in java-operator/src/main/java/com/amazonwebservices/blogs/containers/sigv4/util/HttpUtils.java [72:94]
public static HttpURLConnection createHttpConnection(URL endpointUrl,
String httpMethod,
Map<String, String> headers) {
try {
HttpURLConnection connection = (HttpURLConnection) endpointUrl.openConnection();
connection.setRequestMethod(httpMethod);
if ( headers != null ) {
logger.info("Request headers");
for ( String headerKey : headers.keySet() ) {
logger.info(headerKey + ": " + headers.get(headerKey));
connection.setRequestProperty(headerKey, headers.get(headerKey));
}
}
connection.setUseCaches(false);
connection.setDoInput(true);
connection.setDoOutput(true);
return connection;
} catch (Exception e) {
throw new RuntimeException("Cannot create connection. " + e.getMessage(), e);
}
}