Browse Source

Add Android HTTP Close body

Ben Hsieh 8 years ago
parent
commit
dbb53f9061

+ 4
- 5
src/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java View File

456
                     // It uses customized response body which is able to report download progress
456
                     // It uses customized response body which is able to report download progress
457
                     // and write response data to destination path.
457
                     // and write response data to destination path.
458
                     resp.body().bytes();
458
                     resp.body().bytes();
459
-                } catch (Exception ignored) {
460
-                    ignored.printStackTrace();
461
-                }
459
+                } catch (Exception ignored) {  }
462
                 callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_PATH, this.destPath);
460
                 callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_PATH, this.destPath);
463
                 break;
461
                 break;
464
             default:
462
             default:
469
                 }
467
                 }
470
                 break;
468
                 break;
471
         }
469
         }
472
-        if(!resp.isSuccessful())
473
-            resp.body().close();
470
+//        if(!resp.isSuccessful())
471
+//            resp.body().close();
472
+        resp.body().close();
474
         releaseTaskResource();
473
         releaseTaskResource();
475
     }
474
     }
476
 
475
 

+ 2
- 1
test/test-0.9.4.js View File

35
     .then((res) => {
35
     .then((res) => {
36
       tmp = res.path()
36
       tmp = res.path()
37
       return RNFetchBlob.fetch('POST', `${TEST_SERVER_URL}/upload-form`, {
37
       return RNFetchBlob.fetch('POST', `${TEST_SERVER_URL}/upload-form`, {
38
-        'Content-Type' : 'multipart/form-data'
38
+        'Content-Type' : 'multipart/form-data',
39
+        'Expect' : '100-continue'
39
       }, [
40
       }, [
40
         { name : 'data', data : 'issue#105 test' },
41
         { name : 'data', data : 'issue#105 test' },
41
         { name : 'file', filename : 'github.png', data : RNFetchBlob.wrap(tmp) }
42
         { name : 'file', filename : 'github.png', data : RNFetchBlob.wrap(tmp) }