Bläddra i källkod

Fix FormData compatibility of Blob #44

Ben Hsieh 8 år sedan
förälder
incheckning
4affc4dc80

+ 1
- 1
src/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java Visa fil

@@ -162,7 +162,7 @@ public class RNFetchBlob extends ReactContextBaseJavaModule {
162 162
 
163 163
     @ReactMethod
164 164
     public void slice(String src, String dest, int start, int end, String encode, Callback callback) {
165
-
165
+        RNFetchBlobFS.slice(src, dest, start, end, encode, callback);
166 166
     }
167 167
 
168 168
     @ReactMethod

+ 2
- 2
src/ios/RNFetchBlobReqBuilder.m Visa fil

@@ -88,9 +88,9 @@
88 88
         if([[method lowercaseString] isEqualToString:@"post"] || [[method lowercaseString] isEqualToString:@"put"]) {
89 89
             // generate octet-stream body
90 90
             if(body != nil) {
91
-                
91
+                NSString * cType = [[self class] getHeaderIgnoreCases:@"content-type" fromHeaders:mheaders];
92 92
                 // when headers does not contain a key named "content-type" (case ignored), use default content type
93
-                if([[self class] getHeaderIgnoreCases:@"content-type" fromHeaders:mheaders] == nil)
93
+                if(cType == nil)
94 94
                 {
95 95
                     [mheaders setValue:@"application/octet-stream" forKey:@"Content-Type"];
96 96
                 }

+ 1
- 1
src/polyfill/File.js Visa fil

@@ -10,9 +10,9 @@ export default class File extends Blob {
10 10
   name : string = '';
11 11
 
12 12
   static build(name:string, data:any, cType):Promise<File> {
13
-    this.name = name
14 13
     return new Promise((resolve, reject) => {
15 14
       new File(data, cType).onCreated((f) => {
15
+        f.name = name
16 16
         resolve(f)
17 17
       })
18 18
     })