diff --git a/Libraries/Network/RCTNetworking.h b/Libraries/Network/RCTNetworking.h index 358ab52b6d1..2068f32b803 100644 --- a/Libraries/Network/RCTNetworking.h +++ b/Libraries/Network/RCTNetworking.h @@ -45,8 +45,6 @@ - (RCTNetworkTask *)networkTaskWithRequest:(NSURLRequest *)request completionBlock:(RCTURLRequestCompletionBlock)completionBlock; -- (RCTNetworkTask *)networkTaskWithRequest:(NSURLRequest *)request handler:(id)handler completionBlock:(RCTURLRequestCompletionBlock)completionBlock; - - (void)addRequestHandler:(id)handler; - (void)addResponseHandler:(id)handler; diff --git a/Libraries/Network/RCTNetworking.mm b/Libraries/Network/RCTNetworking.mm index e90c1b29655..22ca45b0fa3 100644 --- a/Libraries/Network/RCTNetworking.mm +++ b/Libraries/Network/RCTNetworking.mm @@ -17,7 +17,6 @@ #import #import -#import #import "RCTNetworkPlugins.h" @@ -394,9 +393,9 @@ RCT_EXPORT_MODULE() } NSURLRequest *request = [RCTConvert NSURLRequest:query[@"uri"]]; if (request) { + __block RCTURLRequestCancellationBlock cancellationBlock = nil; - id handler = [self.moduleRegistry moduleForName:"FileRequestHandler"]; - RCTNetworkTask *task = [self networkTaskWithRequest:request handler:handler completionBlock:^(NSURLResponse *response, NSData *data, NSError *error) { + RCTNetworkTask *task = [self networkTaskWithRequest:request completionBlock:^(NSURLResponse *response, NSData *data, NSError *error) { dispatch_async(self->_methodQueue, ^{ cancellationBlock = callback(error, data ? @{@"body": data, @"contentType": RCTNullIfNil(response.MIMEType)} : nil); }); @@ -677,19 +676,6 @@ RCT_EXPORT_MODULE() return task; } -- (RCTNetworkTask *)networkTaskWithRequest:(NSURLRequest *)request handler:(id)handler completionBlock:(RCTURLRequestCompletionBlock)completionBlock -{ - if (!handler) { - // specified handler is nil, fall back to generic method - return [self networkTaskWithRequest:request completionBlock:completionBlock]; - } - RCTNetworkTask *task = [[RCTNetworkTask alloc] initWithRequest:request - handler:handler - callbackQueue:_methodQueue]; - task.completionBlock = completionBlock; - return task; -} - #pragma mark - JS API RCT_EXPORT_METHOD(sendRequest:(JS::NativeNetworkingIOS::SpecSendRequestQuery &)query