diff --git a/src/main/java/net/frozenorb/apiv3/util/MandrillUtils.java b/src/main/java/net/frozenorb/apiv3/util/MandrillUtils.java index 1378fe9..940ceb2 100644 --- a/src/main/java/net/frozenorb/apiv3/util/MandrillUtils.java +++ b/src/main/java/net/frozenorb/apiv3/util/MandrillUtils.java @@ -27,7 +27,9 @@ public class MandrillUtils { response.exceptionHandler((error) -> { callback.onResult(null, error); }); - }).putHeader(HttpHeaders.CONTENT_TYPE, MediaType.JSON_UTF_8.toString()).end(body.encode()); + }) + .putHeader(HttpHeaders.CONTENT_TYPE, MediaType.JSON_UTF_8.toString()) + .end(body.encode()); } } \ No newline at end of file diff --git a/src/main/java/net/frozenorb/apiv3/util/MaxMindUtils.java b/src/main/java/net/frozenorb/apiv3/util/MaxMindUtils.java index 40787cd..c814644 100644 --- a/src/main/java/net/frozenorb/apiv3/util/MaxMindUtils.java +++ b/src/main/java/net/frozenorb/apiv3/util/MaxMindUtils.java @@ -19,6 +19,8 @@ public class MaxMindUtils { private static final HttpClient httpsClient = APIv3.getVertxInstance().createHttpClient(new HttpClientOptions().setSsl(true).setTrustAll(true)); public static void getInsights(String ip, SingleResultCallback callback) { + String authHeader = "Basic " + Base64.getEncoder().encodeToString((maxMindUserId + ":" + maxMindLicenseKey).getBytes(Charsets.UTF_8)); + httpsClient.get(443, "geoip.maxmind.com", "/geoip/v2.1/insights/" + ip, (response) -> { response.bodyHandler((body) -> { JsonObject bodyJson = new JsonObject(body.toString()); @@ -28,7 +30,9 @@ public class MaxMindUtils { response.exceptionHandler((error) -> { callback.onResult(null, error); }); - }).putHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString((maxMindUserId + ":" + maxMindLicenseKey).getBytes(Charsets.UTF_8))).end(); + }) + .putHeader("Authorization", authHeader) + .end(); } public static String getEnglishName(JsonObject source) {