@Test public void testFetchStatus() throws Exception{ WXStreamModule streamModule = createModule(new IWXHttpAdapter() { @Override public void sendRequest(WXRequest request, OnHttpListener listener) { WXResponse response = new WXResponse(); response.statusCode = "-1"; listener.onHttpFinish(response); } }); Callback finish = new Callback(); streamModule.fetch("",finish,null); assertEquals(finish.mData.get(WXStreamModule.STATUS_TEXT),Status.ERR_INVALID_REQUEST); streamModule.fetch("{method: 'POST',url: 'http: assertEquals(finish.mData.get(WXStreamModule.STATUS_TEXT),Status.ERR_CONNECT_FAILED); streamModule = createModule(new IWXHttpAdapter() { @Override public void sendRequest(WXRequest request, OnHttpListener listener) { WXResponse response = new WXResponse(); response.statusCode = "302"; listener.onHttpFinish(response); } }); streamModule.fetch("{method: 'POST',url: 'http: assertEquals(finish.mData.get(WXStreamModule.STATUS),302); assertEquals(finish.mData.get(WXStreamModule.STATUS).getClass(),Integer.class); assertEquals(finish.mData.get(WXStreamModule.STATUS_TEXT),Status.getStatusText("302")); }
@JSMethod(uiThread = false) public void fetch(JSONObject optionsObj , final JSCallback callback, JSCallback progressCallback){ fetch(optionsObj, callback, progressCallback, mWXSDKInstance.getInstanceId(), mWXSDKInstance.getBundleUrl()); }
WXStreamModule extends WXModule { @JSMethod(uiThread = false) public void fetch(JSONObject optionsObj , final JSCallback callback, JSCallback progressCallback){ fetch(optionsObj, callback, progressCallback, mWXSDKInstance.getInstanceId(), mWXSDKInstance.getBundleUrl()); } }
WXStreamModule extends WXModule { @JSMethod(uiThread = false) public void fetch(JSONObject optionsObj , final JSCallback callback, JSCallback progressCallback){ fetch(optionsObj, callback, progressCallback, mWXSDKInstance.getInstanceId(), mWXSDKInstance.getBundleUrl()); } WXStreamModule();  WXStreamModule(IWXHttpAdapter adapter); }
WXStreamModule extends WXModule { @JSMethod(uiThread = false) public void fetch(JSONObject optionsObj , final JSCallback callback, JSCallback progressCallback){ fetch(optionsObj, callback, progressCallback, mWXSDKInstance.getInstanceId(), mWXSDKInstance.getBundleUrl()); } WXStreamModule();  WXStreamModule(IWXHttpAdapter adapter); @Deprecated @JSMethod(uiThread = false) void sendHttp(JSONObject paramsObj, final String callback); @JSMethod(uiThread = false) void fetch(JSONObject optionsObj , final JSCallback callback, JSCallback progressCallback); void fetch(JSONObject optionsObj , final JSCallback callback, JSCallback progressCallback, String instanceId, String bundleURL); }
WXStreamModule extends WXModule { @JSMethod(uiThread = false) public void fetch(JSONObject optionsObj , final JSCallback callback, JSCallback progressCallback){ fetch(optionsObj, callback, progressCallback, mWXSDKInstance.getInstanceId(), mWXSDKInstance.getBundleUrl()); } WXStreamModule();  WXStreamModule(IWXHttpAdapter adapter); @Deprecated @JSMethod(uiThread = false) void sendHttp(JSONObject paramsObj, final String callback); @JSMethod(uiThread = false) void fetch(JSONObject optionsObj , final JSCallback callback, JSCallback progressCallback); void fetch(JSONObject optionsObj , final JSCallback callback, JSCallback progressCallback, String instanceId, String bundleURL); static final String STATUS_TEXT; static final String STATUS; }