Add log for canceled request. (#304)
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
package com.mapbox.mapboxsdk.module.http;
|
||||
|
||||
import android.os.Build;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mapbox.mapboxsdk.BuildConfig;
|
||||
import com.mapbox.mapboxsdk.constants.MapboxConstants;
|
||||
import com.mapbox.mapboxsdk.http.HttpIdentifier;
|
||||
@@ -13,6 +11,19 @@ import com.mapbox.mapboxsdk.http.HttpLogger;
|
||||
import com.mapbox.mapboxsdk.http.HttpRequest;
|
||||
import com.mapbox.mapboxsdk.http.HttpRequestUrl;
|
||||
import com.mapbox.mapboxsdk.http.HttpResponder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.net.NoRouteToHostException;
|
||||
import java.net.ProtocolException;
|
||||
import java.net.SocketException;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import javax.net.ssl.SSLException;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.Dispatcher;
|
||||
@@ -22,14 +33,6 @@ import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
import javax.net.ssl.SSLException;
|
||||
import java.io.IOException;
|
||||
import java.io.InterruptedIOException;
|
||||
import java.net.NoRouteToHostException;
|
||||
import java.net.ProtocolException;
|
||||
import java.net.SocketException;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import static com.mapbox.mapboxsdk.module.http.HttpRequestUtil.toHumanReadableAscii;
|
||||
|
||||
public class HttpRequestImpl implements HttpRequest {
|
||||
@@ -87,6 +90,7 @@ public class HttpRequestImpl implements HttpRequest {
|
||||
public void cancelRequest() {
|
||||
// call can be null if the constructor gets aborted (e.g, under a NoRouteToHostException).
|
||||
if (call != null) {
|
||||
HttpLogger.log(Log.DEBUG, String.format("[HTTP] Cancel request %s", call.request().url()));
|
||||
call.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user