为什么 Postman 和 Fiddler 从不生成预检请求 [英] Why Postman and Fiddler never generate preflight request

查看:56
本文介绍了为什么 Postman 和 Fiddler 从不生成预检请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我通过 Postman 或 Fiddler 向 API 请求时,永远不会生成预检请求.这两个工具总是生成 Post 或 Get 请求.但是当我们从文件或其他来源生成请求时,它首先生成预检请求并发送 HTTP 选项.

When ever I request to API through Postman or Fiddler never generate Preflight request. Both tool always generate Post or Get request. But when we are generating the request from file or other source then it first generate Preflight request and send HTTP OPTIONS.

问候,

推荐答案

这是因为 CORS 仅适用于沙盒环境,例如浏览器.使用 Fiddler 发出直接 HTTP 请求时,您不需要任何 CORS.preflight 请求在发送实际请求之前由浏览器发送,以确保启用 CORS.

The reason for that is because the CORS only applies to sandboxed environments, like the browser. When making a direct HTTP request with Fiddler you don't need any CORS. The pre-flight request is sent by the browser before sending the actual request to ensure that CORS is enabled.

这篇关于为什么 Postman 和 Fiddler 从不生成预检请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆