Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit 4affc4d

Browse files
committed
Fix FormData compatibility of Blob #44
1 parent dd1cb50 commit 4affc4d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/android/src/main/java/com/RNFetchBlob/RNFetchBlob.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public void cancelRequest(String taskId, Callback callback) {
162162

163163
@ReactMethod
164164
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);
166166
}
167167

168168
@ReactMethod

src/ios/RNFetchBlobReqBuilder.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ +(void) buildOctetRequest:(NSDictionary *)options
8888
if([[method lowercaseString] isEqualToString:@"post"] || [[method lowercaseString] isEqualToString:@"put"]) {
8989
// generate octet-stream body
9090
if(body != nil) {
91-
91+
NSString * cType = [[self class] getHeaderIgnoreCases:@"content-type" fromHeaders:mheaders];
9292
// 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)
9494
{
9595
[mheaders setValue:@"application/octet-stream" forKey:@"Content-Type"];
9696
}

src/polyfill/File.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ export default class File extends Blob {
1010
name : string = '';
1111

1212
static build(name:string, data:any, cType):Promise<File> {
13-
this.name = name
1413
return new Promise((resolve, reject) => {
1514
new File(data, cType).onCreated((f) => {
15+
f.name = name
1616
resolve(f)
1717
})
1818
})

0 commit comments

Comments
 (0)