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

Commit 05841bc

Browse files
committed
if path && POST, use uploadTaskWithRequest:fromFile.
Let sessionSendLaunchEvents and !discretionary.
1 parent bd118af commit 05841bc

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/ios/RNFetchBlobNetwork.m

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ - (void) sendRequest:(__weak NSDictionary * _Nullable )options
223223
{
224224
defaultConfigObject.timeoutIntervalForRequest = timeout/1000;
225225
}
226+
227+
defaultConfigObject.sessionSendsLaunchEvents = YES;
228+
defaultConfigObject.discretionary = NO;
229+
226230
defaultConfigObject.HTTPMaximumConnectionsPerHost = 10;
227231
session = [NSURLSession sessionWithConfiguration:defaultConfigObject delegate:self delegateQueue:taskQueue];
228232
if(path != nil || [self.options valueForKey:CONFIG_USE_TEMP]!= nil)
@@ -254,7 +258,13 @@ - (void) sendRequest:(__weak NSDictionary * _Nullable )options
254258
respFile = NO;
255259
}
256260

257-
__block NSURLSessionDataTask * task = [session dataTaskWithRequest:req];
261+
__block NSURLSessionDataTask * task;
262+
if (path && req.HTTPMethod == @"POST") {
263+
task = [session uploadTaskWithRequest:req fromFile:path];
264+
} else {
265+
task = [session dataTaskWithRequest:req];
266+
}
267+
258268
[taskTable setObject:task forKey:taskId];
259269
[task resume];
260270

0 commit comments

Comments
 (0)