Don't complete requests if mock response wasn't provided

Reviewed By: jingc

Differential Revision: D4959691

fbshipit-source-id: 8a61c6fc559a2be4603b9d01dafa52f7441bd3a6
This commit is contained in:
Andrew Y. Chen 2017-04-27 11:34:26 -07:00 committed by Facebook Github Bot
parent 8478767044
commit 2d3a272e0e
1 changed files with 5 additions and 1 deletions

View File

@ -37,7 +37,7 @@ public class NetworkRecordingModuleMock extends ReactContextBaseJavaModule {
public int mLastRequestId;
public boolean mAbortedRequest;
private final boolean mCompleteRequest;
private boolean mCompleteRequest;
public NetworkRecordingModuleMock(ReactApplicationContext reactContext) {
this(reactContext, true);
@ -116,6 +116,10 @@ public class NetworkRecordingModuleMock extends ReactContextBaseJavaModule {
return true;
}
public void setCompleteRequest(boolean completeRequest) {
mCompleteRequest = completeRequest;
}
private void onDataReceived(int requestId, String data) {
WritableArray args = Arguments.createArray();
args.pushInt(requestId);