You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular Ionic调用Insta360 X2 OSC API预检请求失败求助

Angular Ionic调用Insta360 OSC API时CORS预检请求卡住的问题

我正尝试在Angular Ionic应用中向相机地址http://192.168.42.1/osc/info发送GET请求,但该请求卡在预检阶段,怀疑是CORS问题。尝试了以下代码仍未解决:

getinfo()
{
  const headers = new HttpHeaders({
    'X-XSRF-Protected': '1',
    'Content-Type': 'application/json;charset=utf-8',
    'Accept': 'application/json',
    'Access-Control-Allow-Headers':'*',
    'Access-Control-Allow-Origin':'*',
    'Access-Control-Allow-Methods':'GET'
  })

  this.http.get("http://192.168.42.1/osc/info",{headers: headers}).subscribe(data => {
  console.log("Result:"  + data);
  return data;
}, error => {
  console.log('Error'+ error);
});

该GET方法在另一个ts文件中通过this.results = this.servicename.getinfo();调用,结果用于HTML页面展示。我已遵循INSTA360 OSC API文档传递了指定请求头(GET请求未传Content-Length)。该请求在浏览器或Postman中可正常返回结果,我也曾尝试将主机改为192.168.42.1:6666,还将Content-Type改为text/plain,但问题依旧。请问我遗漏了什么?

内容的提问来源于stack exchange,提问作者Pavan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 12:23:17