V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Lin1998
V2EX  ›  问与答

求助: Angular iPhone / iPad post 请求失败

  •  
  •   Lin1998 · 2020-04-21 05:25:07 +08:00 · 770 次点击
    这是一个创建于 1465 天前的主题,其中的信息可能已经有所发展或是发生改变。

    #大佬们 帮帮忙

    Angular 发送 post 请求时在 iPhone 和 iPad 出现错误 Android, Windows 和 Mac 运行正常.

    后端头部(php):

    header('Access-Control-Allow-Origin:*');

    header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS,PATCH');

    header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');

    header('Access-Control-Allow-Credentials: true');

    请求代码如下:

    this.http.post('https://example/login', data); //data 是个 Json

    如果发送空 Json iPhone 和 iPad 照样失败 空 Json 代码如下

    this.http.post('https://example/login', {});

    以上两种方式 好像没有发送直接失败, 因为后端那边没有收到请求

    但是下面这样的请求运行正常

    this.http.post('https://example/login', "text");

    在本地测试时一切正常, 线上测试时 iPhone 和 iPad 出现了这种状况

    个人认为是 ios 认为请求不够安全所有直接拒绝 但是后端有 SSL 认证(虽然是 DV 级)

    要怎么样才能在 iPhone 和 iPad 上用 post 发送 Json 呢?

    第一次发帖 如果哪里不详细 请大佬们指点 万分感谢 谢谢 谢谢 谢谢

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1262 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 23:21 · PVG 07:21 · LAX 16:21 · JFK 19:21
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.