-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Closed
Labels
BugRan CommandsOne of our bots successfully processed a command.One of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.🌐NetworkingRelated to a networking API.Related to a networking API.
Description
fetch response.text() gives responseData=[Object Blob]
"react-native: 0.60.4
"react": "16.8.6",
Steps To Reproduce
1.react-native init project
2.fetch one request
3.console the response
function request(url, option) {
const newOptions = option
if (newOptions.method === 'POST') {
newOptions.body = JSON.stringify(newOptions.body)
}
return fetch(url, newOptions)
.then(response => {
console.log('newOptions', newOptions)
console.log('response', response)
return response.text()
})
.then(body => {
console.log('body', body)
})
.catch(e => {
console.log('e', e)
})
}
// get request
export async function get(url, params) {
let requrl = stringify(params, { indices: false })
return request(`${baseUrl}${url}?${requrl}`, {
method: 'GET',
headers: {
Authorization: `Bearer ${token}`,
'content-type': 'application/json'
}
})
}
console result
response={
bodyUsed: true
headers: Headers
map: {content-type: "application/vnd.api+json", content-length: "551"}
__proto__: Object
ok: true
status: 200
statusText: ""
type: "default"
url: "https://chain-api.test.com/question/list?"
_bodyInit: Blob {size: 1177, type: "application/vnd.api+json"}
_bodyText: "[object Blob]"
}
body [object Blob]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugRan CommandsOne of our bots successfully processed a command.One of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.🌐NetworkingRelated to a networking API.Related to a networking API.