在带有Axios的React Native内部,我正在使用axios向远程URL发出请求。如果我尝试提出请求,就会不断收到此错误。
The file “Macintosh HD” couldn’t be opened because you don’t have permission to view it.
这是我的一些代码:
// inside componentDidLoad()
ExampleService.index().then(response => {
console.log('service response: ',response);
})
// in side ExampleService.js
function index() {
return client({
url: `/`,
method: 'GET'
});
}
// inside client
const client = axios.create({
baseUrl: 'http://192.168.42.64:3000',
headers: {
// 'Authorization': authHeader,
'Content-Type': 'application/json'
}
});