diff --git a/Libraries/Network/RCTNetworking.mm b/Libraries/Network/RCTNetworking.mm index 24c175294aed95..9b9c12711dea7c 100644 --- a/Libraries/Network/RCTNetworking.mm +++ b/Libraries/Network/RCTNetworking.mm @@ -111,7 +111,7 @@ - (RCTURLRequestCancellationBlock)handleResult:(NSDictionary *)r // Print headers. NSMutableDictionary *headers = [_parts[0][@"headers"] mutableCopy]; NSString *partContentType = result[@"contentType"]; - if (partContentType != nil) { + if (partContentType != nil && ![partContentType isEqual:[NSNull null]]) { headers[@"content-type"] = partContentType; } [headers enumerateKeysAndObjectsUsingBlock:^(NSString *parameterKey, NSString *parameterValue, BOOL *stop) { @@ -331,7 +331,8 @@ - (RCTURLRequestCancellationBlock)buildRequest:(NSDictionary *)q request.HTTPBody = result[@"body"]; NSString *dataContentType = result[@"contentType"]; NSString *requestContentType = [request valueForHTTPHeaderField:@"Content-Type"]; - BOOL isMultipart = [dataContentType hasPrefix:@"multipart"]; + BOOL isMultipart = ![dataContentType isEqual:[NSNull null]] && + [dataContentType hasPrefix:@"multipart"]; // For multipart requests we need to override caller-specified content type with one // from the data object, because it contains the boundary string