react-native/Libraries/Network
Janic Duplessis f5207ba9c7 Fix blob response parsing for empty body on iOS
Summary:
We currently handle empty body poorly in the iOS blob implementation, this happens because of an early return that cause the blob response to not be processed by the blob module, resulting in an empty string as the body instead of a blob object. We also need to make sure to create an empty blob object when data is nil (empty body) as per the XMLHttpRequest spec. The Android implementation was already handling this properly.

Fixes #18223

Send a HEAD request

```js
fetch('https://apipre.monkimun.com/whoami', {
  body: null,
  method: 'HEAD',
  headers: {
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
})
```

[IOS][BUGFIX][Blob] - Fix blob response parsing for empty body
Closes https://github.com/facebook/react-native/pull/18547

Differential Revision: D7415950

Pulled By: hramos

fbshipit-source-id: 56860532c6171255869f02a0960f55d155184a46
2018-03-27 11:13:34 -07:00
..
RCTNetwork.xcodeproj Standardize project indentation settings on 2 spaces 2017-07-31 05:20:03 -07:00
__tests__ Update license headers for MIT license 2018-02-16 18:31:53 -08:00
FormData.js Update license headers for MIT license 2018-02-16 18:31:53 -08:00
NetInfo.js Fix ESLint warnings using 'yarn lint --fix' 2018-02-22 07:23:17 -08:00
RCTDataRequestHandler.h Update license headers for MIT license 2018-02-16 18:31:53 -08:00
RCTDataRequestHandler.m Update license headers for MIT license 2018-02-16 18:31:53 -08:00
RCTFileRequestHandler.h Update license headers for MIT license 2018-02-16 18:31:53 -08:00
RCTFileRequestHandler.m Update license headers for MIT license 2018-02-16 18:31:53 -08:00
RCTHTTPRequestHandler.h Update license headers for MIT license 2018-02-16 18:31:53 -08:00
RCTHTTPRequestHandler.mm Update license headers for MIT license 2018-02-16 18:31:53 -08:00
RCTNetInfo.h Update license headers for MIT license 2018-02-16 18:31:53 -08:00
RCTNetInfo.m Properly tear down the reachabilityRef in RCTNetInfo 2018-03-19 11:00:23 -07:00
RCTNetworkTask.h Update license headers for MIT license 2018-02-16 18:31:53 -08:00
RCTNetworkTask.m Update license headers for MIT license 2018-02-16 18:31:53 -08:00
RCTNetworking.android.js Update license headers for MIT license 2018-02-16 18:31:53 -08:00
RCTNetworking.h Update license headers for MIT license 2018-02-16 18:31:53 -08:00
RCTNetworking.ios.js Update license headers for MIT license 2018-02-16 18:31:53 -08:00
RCTNetworking.mm Fix blob response parsing for empty body on iOS 2018-03-27 11:13:34 -07:00
XHRInterceptor.js Update license headers for MIT license 2018-02-16 18:31:53 -08:00
XMLHttpRequest.js Update license headers for MIT license 2018-02-16 18:31:53 -08:00
convertRequestBody.js Update license headers for MIT license 2018-02-16 18:31:53 -08:00
fetch.js Update license headers for MIT license 2018-02-16 18:31:53 -08:00