Search in sources :

Example 6 with HttpGetRequest

use of com.google.firebase.crashlytics.internal.network.HttpGetRequest in project firebase-android-sdk by firebase.

the class DefaultSettingsSpiCall method invoke.

@Override
public JSONObject invoke(SettingsRequest requestData, boolean dataCollectionToken) {
    if (!dataCollectionToken) {
        throw new RuntimeException("An invalid data collection token was used.");
    }
    JSONObject toReturn = null;
    try {
        final Map<String, String> queryParams = getQueryParamsFor(requestData);
        HttpGetRequest httpRequest = createHttpGetRequest(queryParams);
        httpRequest = applyHeadersTo(httpRequest, requestData);
        logger.d("Requesting settings from " + url);
        logger.v("Settings query params were: " + queryParams);
        final HttpResponse httpResponse = httpRequest.execute();
        toReturn = handleResponse(httpResponse);
    } catch (IOException e) {
        logger.e("Settings request failed.", e);
        toReturn = null;
    }
    return toReturn;
}
Also used : JSONObject(org.json.JSONObject) HttpResponse(com.google.firebase.crashlytics.internal.network.HttpResponse) HttpGetRequest(com.google.firebase.crashlytics.internal.network.HttpGetRequest) IOException(java.io.IOException)

Aggregations

HttpGetRequest (com.google.firebase.crashlytics.internal.network.HttpGetRequest)6 HttpRequestFactory (com.google.firebase.crashlytics.internal.network.HttpRequestFactory)4 InspectableHttpGetRequest (com.google.firebase.crashlytics.internal.network.InspectableHttpGetRequest)4 HttpResponse (com.google.firebase.crashlytics.internal.network.HttpResponse)2 SettingsRequest (com.google.firebase.crashlytics.internal.settings.model.SettingsRequest)2 IOException (java.io.IOException)2 JSONObject (org.json.JSONObject)2