throws GeoIp2Exception {
String body;
try {
body = response.parseAsString();
} catch (IOException e) {
throw new GeoIp2Exception(
"Received a 200 response but not decode message body: "
+ e.getMessage());
}
if (response.getContentType() == null
|| !response.getContentType().contains("json")) {
throw new GeoIp2Exception("Received a 200 response for " + uri
+ " but it does not appear to be JSON:\n" + body);
}
return body;
}