-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Closed
Labels
StaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.
Description
Is this a bug report?
Yes
Android use fetch dont't work with "deflate" encoded responses.json().
I copy the same fetch in browser try to it will response the right encoded json.
Environment
react-native -v
: 0.47.2node -v
: 8.0.0npm -v
: 5.3.0
Then, specify:
-
Target Platform: Android
-
Development Operating System: Windows
-
Build tools: Android SDK
Steps to Reproduce
fetch(url, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json;charset=UTF-8',
},
body: JSON.stringify(options),
compress: true,
})
.then((response) => {
console.log(response);
return response.json();
})
.then((result) => {
// result is messy code
});
Expected Behavior
right to encoded.
Actual Behavior
return messy code
Reproducible Demo
Unhandled Promise Rejection (id: 0):
SyntaxError: Unexpected token { in JSON at position 0
at parse (<anonymous>)
at tryCallOne (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:13773:12)
at http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:13859:15
at http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:5290:19
at _callTimer (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:5204:7)
at Object.callImmediatesPass (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:5432:9)
at Object.callImmediates (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:5443:21)
at MessageQueue.__callImmediates (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:4803:16)
at http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:4689:16
at MessageQueue.__guard (http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false:4789:9)
Metadata
Metadata
Assignees
Labels
StaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.