Procházet zdrojové kódy

remove unnecessary code

Ben Hsieh před 8 roky
rodič
revize
3793e49b5f

+ 2
- 0
src/android/src/main/java/com/RNFetchBlob/RNFetchBlobBody.java Zobrazit soubor

@@ -370,6 +370,8 @@ public class RNFetchBlobBody extends RequestBody{
370 370
      * @param written
371 371
      */
372 372
     private void emitUploadProgress(int written) {
373
+        if(!RNFetchBlobReq.isReportProgress(mTaskId))
374
+            return;
373 375
         WritableMap args = Arguments.createMap();
374 376
         args.putString("taskId", mTaskId);
375 377
         args.putString("written", String.valueOf(written));

+ 0
- 5
src/ios/RNFetchBlobNetwork.m Zobrazit soubor

@@ -353,11 +353,6 @@ NSOperationQueue *taskQueue;
353 353
     {
354 354
         errMsg = [error localizedDescription];
355 355
     }
356
-    // Fix #72 response with status code 200 ~ 299 considered as success
357
-    else if(respStatus> 299 || respStatus < 200)
358
-    {
359
-        errMsg = [NSString stringWithFormat:@"Request failed, status %d", respStatus];
360
-    }
361 356
     else
362 357
     {
363 358
         if(respFile == YES)

+ 0
- 19
test/test-0.9.5.js Zobrazit soubor

@@ -30,25 +30,6 @@ let prefix = ((Platform.OS === 'android') ? 'file://' : '')
30 30
 
31 31
 describe('issue #122 force response data format', (report, done) => {
32 32
 
33
-  RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/json-dummy.json`, {
34
-    'RNFB-Response' : 'base64'
35
-  })
36
-  .then((res) => {
37
-    let r = RNFetchBlob.base64.decode(res.data)
38
-    report(
39
-      <Assert key="test data verify" expect="fetchblob-dev" actual={JSON.parse(r).name}/>,
40
-      <Assert key="should successfully decode the data" expect={true} actual={true}/>)
41
-    return RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/json-dummy.json`)
42
-  })
43
-  .then((res) => {
44
-    report(
45
-      <Assert key="response should in format of plain-text" expect="fetchblob-dev" actual={JSON.parse(res.data).name}/>)
46
-    done()
47
-  })
48
-  .catch(() => {
49
-    report(
50
-      <Assert key="Should successfully decode the data" expect={true} actual={false}/>)
51
-    done()
52 33
   })
53 34
 
54 35
 })

+ 19
- 18
test/test-init.js Zobrazit soubor

@@ -18,8 +18,8 @@ const { Assert, Comparer, Info, prop } = RNTest
18 18
 // test environment variables
19 19
 
20 20
 prop('FILENAME', `${Platform.OS}-0.8.0-${Date.now()}.png`)
21
-prop('TEST_SERVER_URL', 'http://192.168.16.70:8123')
22
-prop('TEST_SERVER_URL_SSL', 'https://192.168.16.70:8124')
21
+prop('TEST_SERVER_URL', 'http://192.168.0.14:8123')
22
+prop('TEST_SERVER_URL_SSL', 'https://192.168.0.14:8124')
23 23
 prop('DROPBOX_TOKEN', 'fsXcpmKPrHgAAAAAAAAAoXZhcXYWdgLpQMan6Tb_bzJ237DXhgQSev12hA-gUXt4')
24 24
 prop('styles', {
25 25
   image : {
@@ -59,21 +59,22 @@ describe('GET image from server', (report, done) => {
59 59
 })
60 60
 
61 61
 
62
-require('./test-0.1.x-0.4.x')
63
-require('./test-0.5.1')
64
-require('./test-0.5.2')
65
-require('./test-0.6.0')
66
-require('./test-0.6.2')
67
-require('./test-0.7.0')
68
-require('./test-0.8.0')
69
-require('./test-0.9.0')
70
-require('./test-0.9.2')
71
-require('./test-0.9.4')
72
-require('./test-fetch')
73
-require('./test-fs')
74
-require('./test-xmlhttp')
75
-require('./test-blob')
76
-require('./test-firebase')
77
-require('./test-android')
62
+// require('./test-0.1.x-0.4.x')
63
+// require('./test-0.5.1')
64
+// require('./test-0.5.2')
65
+// require('./test-0.6.0')
66
+// require('./test-0.6.2')
67
+// require('./test-0.7.0')
68
+// require('./test-0.8.0')
69
+// require('./test-0.9.0')
70
+// require('./test-0.9.2')
71
+// require('./test-0.9.4')
72
+require('./test-0.9.5')
73
+// require('./test-fetch')
74
+// require('./test-fs')
75
+// require('./test-xmlhttp')
76
+// require('./test-blob')
77
+// require('./test-firebase')
78
+// require('./test-android')
78 79
 // require('./test-stress')
79 80
 // require('./benchmark')

+ 1
- 1
test/test-xmlhttp.js Zobrazit soubor

@@ -136,7 +136,7 @@ describe('HTTP error should not throw error event', (report, done) => {
136 136
     xhr.onerror = function() {
137 137
       report(
138 138
         <Assert
139
-          key={`HTTP error ${code} should not throw error event`}
139
+          key={`HTTP status ${code} should not throw error event`}
140 140
           expect={false}
141 141
           actual={true}/>)
142 142
     }