【发布时间】:2020-07-11 02:25:41
【问题描述】:
我正在尝试使用 cordova 插件“cordova-HTTP”从我的 Android 模拟器向运行模拟器的笔记本电脑发送 GET 请求:
cordovaHTTP.get(
"http://10.0.2.2:80/",
{},
{},
function(response) {
console.log('success called');
},
function(error_response) {console.log('error called'); console.log(error_response.status);}
);
错误回调被调用,状态码为 500(= 内部服务器错误)。但是在我的笔记本电脑上,我可以通过 tcpdump 看到甚至没有收到任何包裹。为什么这个非常简单的 GET 请求不起作用?
当我在模拟器上使用 Google Chrome 并导航到“http://10.0.2.2:80/”时一切正常,我看到了安装在笔记本电脑上的 Apache2 网络服务器的虚拟页面。
【问题讨论】:
标签: cordova http android-emulator cordova-plugins http-get