我试图在本机应用程序中发出http请求,但它会抛出错误
Uncaught Error: unsupported BodyInit type
at Response.Body._initBody (index.bundle?platform=android&dev=true&minify=false:13594)
at new Response (index.bundle?platform=android&dev=true&minify=false:13765)
at XMLHttpRequest.xhr.onload (index.bundle?platform=android&dev=true&minify=false:13820)
在应用程序的index.js中我添加了这一行
GLOBAL.XMLHttpRequest = GLOBAL.originalXMLHttpRequest || GLOBAL.XMLHttpRequest
获取请求
const headers = {};
headers['Accept'] = 'application/json';
headers['Content-Type'] = 'application/json';
let response = await fetch('https://www.saramashkim.co.il/api/get_all_product', {
method: 'GET',
headers: headers,
body: null,
})
当我在POSTMAN中检查这个网址时,它工作正常,我得到了所有数据..
答案 0 :(得分:1)
尝试以下代码:
mkdir -p /home/gitlab-runner/cache/web/app/app/
sudo chown -R gitlab-runner:gitlab-runner /home/gitlab-runner/cache/
您可以看到响应已记录到控制台。 (我已经更新了我的答案)