【问题标题】:What is the correct success status code for Preflights(option) request? [duplicate]Preflight(options) 请求的正确成功状态代码是什么? [复制]
【发布时间】:2019-10-05 08:18:33
【问题描述】:

我们正在为旧的后端 (java) 开发新的前端 (angular)。启用 cors 后,所有请求(POST)都按预期工作。

但是 preflights(option) 请求响应为“状态代码 202 OK”。

所以在深入研究和更改“工作代码”之前,我在这里问,“预检(选项)”请求的标准成功代码是什么?

【问题讨论】:

    标签: cors preflight http-status


    【解决方案1】:

    按照规范https://fetch.spec.whatwg.org/#cors-preflight-fetch

    从 200 到 299 都可以。

    您应该只发回通常为任何其他 OPTIONS 请求发回的 CORS 预检 OPTIONS 请求的状态。相关规范仅此而已。

    【讨论】:

      猜你喜欢
      • 2018-02-24
      • 2018-02-12
      • 1970-01-01
      • 1970-01-01
      • 2012-03-13
      • 2014-04-25
      • 2018-09-08
      • 2016-06-10
      相关资源
      最近更新 更多