9304df3e3d
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 |
||
---|---|---|
.. | ||
RCTNetwork.xcodeproj | ||
__tests__ | ||
FormData.js | ||
NetInfo.js | ||
RCTDataRequestHandler.h | ||
RCTDataRequestHandler.m | ||
RCTFileRequestHandler.h | ||
RCTFileRequestHandler.m | ||
RCTHTTPRequestHandler.h | ||
RCTHTTPRequestHandler.m | ||
RCTNetInfo.h | ||
RCTNetInfo.m | ||
RCTNetworkTask.h | ||
RCTNetworkTask.m | ||
RCTNetworking.android.js | ||
RCTNetworking.h | ||
RCTNetworking.ios.js | ||
RCTNetworking.mm | ||
XMLHttpRequest.js |