use of com.google.firebase.crashlytics.internal.network.HttpRequest in project GreenHouse by utsanjan.
the class AbstractAppSpiCall method invoke.
// com.google.firebase.crashlytics.internal.settings.network.AppSpiCall
@Override
public boolean invoke(AppRequestData requestData, boolean dataCollectionToken) {
if (dataCollectionToken) {
HttpRequest httpRequest = applyMultipartDataTo(applyHeadersTo(getHttpRequest(), requestData), requestData);
Logger logger = Logger.getLogger();
logger.d("Sending app info to " + getUrl());
try {
HttpResponse httpResponse = httpRequest.execute();
int statusCode = httpResponse.code();
String kind = "POST".equalsIgnoreCase(httpRequest.method()) ? "Create" : "Update";
Logger logger2 = Logger.getLogger();
logger2.d(kind + " app request ID: " + httpResponse.header(AbstractSpiCall.HEADER_REQUEST_ID));
Logger logger3 = Logger.getLogger();
logger3.d("Result was " + statusCode);
return ResponseParser.parse(statusCode) == 0;
} catch (IOException ioe) {
Logger.getLogger().e("HTTP request failed.", ioe);
throw new RuntimeException(ioe);
}
} else {
throw new RuntimeException("An invalid data collection token was used.");
}
}
Aggregations