Is this a bug report?
Yes
Yes
Environment
OS: Windows 10
Node: v8.1.3
Yarn: 1.2.0
npm: 5.0.3
Watchman: Not Found
Xcode: Not Found
Android Studio: 2.3.3
Packages: (wanted => installed)
react-native: 0.49.5 => 0.49.5
react: 16.0.0-alpha.12 => 16.0.0-alpha.12
Target Platform: Android - iOS
Steps to Reproduce
Run the following code
import React, { Component } from 'react';
import {
Text,
} from 'react-native';
export default class App extends Component {
async componentDidMount() {
const fetchResponse = await fetch('https://postman-echo.com/post', {
method: 'POST',
headers: {
'Content-Type': 'application/octet-stream',
},
body: new Uint8Array([1,2,3,4,5,6,7,8,9,0]),
});
const fetchResponseBody = await fetchResponse.arrayBuffer();
}
render() {
return (
<Text>
Open console and see logs
</Text>
);
}
}
The first issue is TypeError: fetchResponse.arrayBuffer is not a function , to solve it follow https://github.com/facebook/react-native/pull/16585/files so we have no error at https://github.com/github/fetch/blob/master/fetch.js#L16 for new Blob()
But new issue is here https://github.com/facebook/react-native/blob/master/Libraries/Blob/Blob.js#L99 before running fetchResponse.arrayBuffer();
Expected Behavior
According to https://developer.mozilla.org/en-US/docs/Web/API/Response
Response implements Body, so it also has the following methods available to it:
Body.arrayBuffer()
Takes a Response stream and reads it to completion. It returns a promise that resolves with an ArrayBuffer.
Body.blob()
Takes a Response stream and reads it to completion. It returns a promise that resolves with a Blob.
Body.formData()
Takes a Response stream and reads it to completion. It returns a promise that resolves with a FormData object.
Body.json()
Takes a Response stream and reads it to completion. It returns a promise that resolves with the result of parsing the body text as JSON.
Body.text()
Takes a Response stream and reads it to completion. It returns a promise that resolves with a USVString (text).
and currently we missing Body.arrayBuffer() and Body.blob()
Actual Behavior
We have some error
1- TypeError: fetchResponse.arrayBuffer is not a function for Body.arrayBuffer() , more details at #16585
2- Can currently only create a Blob from other Blobs at https://github.com/facebook/react-native/blob/master/Libraries/Blob/Blob.js#L99
Reproducible Demo
Replace App component in the new initialized project
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Steps to Reproduce
Run the following code
The first issue is
TypeError: fetchResponse.arrayBuffer is not a function, to solve it follow https://github.com/facebook/react-native/pull/16585/files so we have no error at https://github.com/github/fetch/blob/master/fetch.js#L16 fornew Blob()But new issue is here https://github.com/facebook/react-native/blob/master/Libraries/Blob/Blob.js#L99 before running
fetchResponse.arrayBuffer();Expected Behavior
According to https://developer.mozilla.org/en-US/docs/Web/API/Response
and currently we missing
Body.arrayBuffer()andBody.blob()Actual Behavior
We have some error
1-
TypeError: fetchResponse.arrayBuffer is not a functionforBody.arrayBuffer(), more details at #165852-
Can currently only create a Blob from other Blobsat https://github.com/facebook/react-native/blob/master/Libraries/Blob/Blob.js#L99Reproducible Demo
Replace
Appcomponent in the new initialized project