@@ -129,7 +129,7 @@ - (NSDictionary *)constantsToExport
129129
130130 // send HTTP request
131131 RNFetchBlobNetwork * utils = [[RNFetchBlobNetwork alloc ] init ];
132- [utils sendRequest: options bridge: self .bridge taskId: taskId withRequest: request withData: postData callback: callback];
132+ [utils sendRequest: options bridge: self .bridge taskId: taskId withRequest: request callback: callback];
133133 });
134134}
135135
@@ -147,7 +147,6 @@ - (NSDictionary *)constantsToExport
147147 URLWithString: url]];
148148
149149 NSMutableDictionary *mheaders = [[NSMutableDictionary alloc ] initWithDictionary: [RNFetchBlobNetwork normalizeHeaders: headers]];
150-
151150 // move heavy task to another thread
152151 dispatch_async (dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0 ), ^{
153152 NSMutableData * blobData;
@@ -159,12 +158,15 @@ - (NSDictionary *)constantsToExport
159158 // when body is a string contains file path prefix, try load file from the path
160159 if ([body hasPrefix: self .filePathPrefix]) {
161160 NSString * orgPath = [body substringFromIndex: [self .filePathPrefix length ]];
162- blobData = [[NSData alloc ] initWithContentsOfFile: orgPath];
161+ [request setHTTPBodyStream: [NSInputStream inputStreamWithFileAtPath: orgPath ]];
162+ // blobData = [[NSData alloc] initWithContentsOfFile:orgPath];
163163 }
164164 // otherwise convert it as BASE64 data string
165- else
165+ else {
166166 blobData = [[NSData alloc ] initWithBase64EncodedString: body options: 0 ];
167- [request setHTTPBody: blobData];
167+ [request setHTTPBody: blobData];
168+ }
169+
168170 [mheaders setValue: @" application/octet-stream" forKey: @" content-type" ];
169171
170172 }
@@ -175,7 +177,7 @@ - (NSDictionary *)constantsToExport
175177
176178 // send HTTP request
177179 RNFetchBlobNetwork * utils = [[RNFetchBlobNetwork alloc ] init ];
178- [utils sendRequest: options bridge: self .bridge taskId: taskId withRequest: request withData: blobData callback: callback];
180+ [utils sendRequest: options bridge: self .bridge taskId: taskId withRequest: request callback: callback];
179181 });
180182}
181183
0 commit comments