diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/network/OkHttpCallUtil.java b/ReactAndroid/src/main/java/com/facebook/react/common/network/OkHttpCallUtil.java index 4da3a5e9b..1d199203c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/network/OkHttpCallUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/network/OkHttpCallUtil.java @@ -24,11 +24,13 @@ public class OkHttpCallUtil { for (Call call : client.dispatcher().queuedCalls()) { if (tag.equals(call.request().tag())) { call.cancel(); + return; } } for (Call call : client.dispatcher().runningCalls()) { if (tag.equals(call.request().tag())) { call.cancel(); + return; } } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java index 1410f085e..97a803965 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java @@ -384,7 +384,7 @@ public final class NetworkingModule extends ReactContextBaseJavaModule { new GuardedAsyncTask(getReactApplicationContext()) { @Override protected void doInBackgroundGuarded(Void... params) { - OkHttpCallUtil.cancelTag(mClient, requestId); + OkHttpCallUtil.cancelTag(mClient, Integer.valueOf(requestId)); } }.execute(); }