Pārlūkot izejas kodu

Remove extra semi-column when Fetch Replacement parsing FormData #288

Remove extra semi-column when Fetch Replacement parsing FormData #288

This is non-standard behavior which may cause server side incompatible.
Ben Hsieh 7 gadus atpakaļ
vecāks
revīzija
785fd0e861
2 mainītis faili ar 7 papildinājumiem un 8 dzēšanām
  1. 4
    3
      polyfill/Blob.js
  2. 3
    5
      polyfill/Fetch.js

+ 4
- 3
polyfill/Blob.js Parādīt failu

@@ -11,8 +11,8 @@ import EventTarget from './EventTarget'
11 11
 const log = new Log('Blob')
12 12
 const blobCacheDir = fs.dirs.DocumentDir + '/RNFetchBlob-blobs/'
13 13
 
14
-log.disable()
15
-// log.level(3)
14
+// log.disable()
15
+log.level(3)
16 16
 
17 17
 /**
18 18
  * A RNFetchBlob style Blob polyfill class, this is a Blob which compatible to
@@ -113,7 +113,7 @@ export default class Blob extends EventTarget {
113 113
           formArray.push('\r\n--'+boundary+'\r\n')
114 114
           let part = parts[i]
115 115
           for(let j in part.headers) {
116
-            formArray.push(j + ': ' +part.headers[j] + ';\r\n')
116
+            formArray.push(j + ': ' +part.headers[j] + '\r\n')
117 117
           }
118 118
           formArray.push('\r\n')
119 119
           if(part.isRNFetchBlobPolyfill)
@@ -342,5 +342,6 @@ function createMixedBlobData(ref, dataArray) {
342 342
       return fs.appendFile(...arg)
343 343
     }.bind(args[i]))
344 344
   }
345
+  console.log('###ref', ref)
345 346
   return p.then(() => Promise.resolve(size))
346 347
 }

+ 3
- 5
polyfill/Fetch.js Parādīt failu

@@ -6,8 +6,8 @@ import Blob from './Blob'
6 6
 
7 7
 const log = new Log('FetchPolyfill')
8 8
 
9
-log.disable()
10
-// log.level(3)
9
+// log.disable()
10
+log.level(3)
11 11
 
12 12
 export default class Fetch {
13 13
 
@@ -32,7 +32,6 @@ class RNFetchBlobFetchPolyfill {
32 32
       options.headers['Content-Type'] = ctype || ctypeH
33 33
       options.headers['content-type'] = ctype || ctypeH
34 34
       options.method = options.method || 'GET'
35
-
36 35
       if(body) {
37 36
         // When the request body is an instance of FormData, create a Blob cache
38 37
         // to upload the body.
@@ -55,7 +54,6 @@ class RNFetchBlobFetchPolyfill {
55 54
         else
56 55
           promise = Promise.resolve(body)
57 56
       }
58
-
59 57
       // task is a progress reportable and cancellable Promise, however,
60 58
       // task.then is not, so we have to extend task.then with progress and
61 59
       // cancel function
@@ -69,7 +67,7 @@ class RNFetchBlobFetchPolyfill {
69 67
         log.verbose('response', resp)
70 68
         // release blob cache created when sending request
71 69
         if(blobCache !== null && blobCache instanceof Blob)
72
-          blobCache.close()
70
+          // blobCache.close()
73 71
         return Promise.resolve(new RNFetchBlobFetchRepsonse(resp))
74 72
       })
75 73