Ben Hsieh 8 gadus atpakaļ
vecāks
revīzija
42b13a5877
2 mainītis faili ar 5 papildinājumiem un 5 dzēšanām
  1. 1
    1
      src/index.js
  2. 4
    4
      test/tests.js

+ 1
- 1
src/index.js Parādīt failu

@@ -25,7 +25,7 @@ const fetch = (...args) => {
25 25
     let [method, url, headers, body] = [...args]
26 26
     let nativeMethodName = Array.isArray(body) ? 'fetchBlobForm' : 'fetchBlob'
27 27
 
28
-    RNFetchBlob[nativeMethodName](method, url, headers, body, (err, ...data) => {
28
+    RNFetchBlob[nativeMethodName](method, url, headers || {}, body, (err, ...data) => {
29 29
       if(err)
30 30
         reject(new Error(err, ...data))
31 31
       else

+ 4
- 4
test/tests.js Parādīt failu

@@ -15,8 +15,8 @@ import {
15 15
 
16 16
 const FILENAME = `${Platform.OS}-0.4.0-${Date.now()}.png`
17 17
 // paste your test config here
18
-const TEST_SERVER_URL = 'http://your-local-ip:8123'
19
-const DROPBOX_TOKEN = 'drop-box-api-token'
18
+const TEST_SERVER_URL = 'http://192.168.17.207:8123'
19
+const DROPBOX_TOKEN = 'fsXcpmKPrHgAAAAAAAAAEGxFXwhejXM_E8fznZoXPhHbhbNhA-Lytbe6etp1Jznz'
20 20
 
21 21
 const ctx = new RNTest.TestContext()
22 22
 const Assert = RNTest.Assert
@@ -88,8 +88,8 @@ ctx.describe('Upload multipart/form-data', async function(report, data) {
88 88
 
89 89
 ctx.describe('Compare uploaded multipart image', async function(report) {
90 90
   // try {
91
-    let resp = await RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/test-img.png`, {})
92
-    let resp2 = await RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/test-text.txt`, {})
91
+    let resp = await RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/test-img.png`)
92
+    let resp2 = await RNFetchBlob.fetch('GET', `${TEST_SERVER_URL}/public/test-text.txt`)
93 93
     console.log(resp)
94 94
     console.log(resp2)
95 95
     report({