react-native/Libraries/Network
Adam Comella 9304df3e3d For file uploads, don't stomp on developer's Content-Type header
Summary:
Currently when doing a file upload, the Content-Type header gets set to whatever MIME type iOS computed for the file. The Content-Type header the developer provided never takes precedence.

For example, when uploading an image, iOS might determine that the MIME type is "image/jpeg" and so this would be the Content-Type of the HTTP request. But the developer might need the Content-Type to be "application/octet-stream". With this change, if the developer provides a Content-Type header, it will not be overriden.

There is only one exception to this rule which is for "multipart" requests. In this case, the developer's Content-Type header is always ignored. This is because the Content-Type header needs to contain the boundary string and that information is not available to the developer in JavaScript.

This change makes iOS's behavior more consistent with Android's.

**Test plan (required)**

In a small test app, verified that the developer's Content-Type header takes precedence when it's provided. Verif
Closes https://github.com/facebook/react-native/pull/9651

Differential Revision: D3820001

Pulled By: mkonicek

fbshipit-source-id: fdb8871f88a0d0db1ae59f75bb62b896fe69542d
2016-09-05 14:58:40 -07:00
..
RCTNetwork.xcodeproj Fix some unsafe thread behavior 2016-09-01 19:58:58 -07:00
__tests__ re-enable and fix tests 2016-09-03 01:13:37 -07:00
FormData.js Auto-fix lint errors 2016-08-09 06:43:46 -07:00
NetInfo.js Auto-fix lint errors 2016-08-09 06:43:46 -07:00
RCTDataRequestHandler.h Added RCTDataRequestHandler 2015-10-19 09:07:06 -07:00
RCTDataRequestHandler.m Fix retain cyles in RCTNetworkTask when used with RCTFileRequestHandler and RCTDataRequestHandler 2015-11-04 07:16:26 -08:00
RCTFileRequestHandler.h Added RCTFileRequestHandler 2015-10-13 08:14:28 -07:00
RCTFileRequestHandler.m Support bundle argument for image loading 2016-08-31 17:43:49 -07:00
RCTHTTPRequestHandler.h Refactored networking logic out into RCTDownloadTask 2015-07-23 04:00:31 -08:00
RCTHTTPRequestHandler.m Avoid dispatching network callbacks when already on the right queue 2016-08-17 10:44:01 -07:00
RCTNetInfo.h Update RCTNetworking, RCTNetInfo and RCTLocationManager to use new events system 2016-05-25 04:28:36 -07:00
RCTNetInfo.m Update RCTNetworking, RCTNetInfo and RCTLocationManager to use new events system 2016-05-25 04:28:36 -07:00
RCTNetworkTask.h Perform all callbacks from RCTNetworkTasks on a given queue 2016-08-17 10:44:01 -07:00
RCTNetworkTask.m Add some defensive cleanup of cancelBlock in RCTImageLoader 2016-08-19 10:46:09 -07:00
RCTNetworking.android.js Add responseType as a concept to RCTNetworking, send binary data as base64 2016-07-13 04:58:37 -07:00
RCTNetworking.h Update RCTNetworking, RCTNetInfo and RCTLocationManager to use new events system 2016-05-25 04:28:36 -07:00
RCTNetworking.ios.js Support RCTNetworking#clearCookies on iOS 2016-08-26 05:43:39 -07:00
RCTNetworking.mm For file uploads, don't stomp on developer's Content-Type header 2016-09-05 14:58:40 -07:00
XMLHttpRequest.js fix new flow errors after D3561327 2016-07-14 04:58:43 -07:00