为什么邮递员和提琴手从不生成飞行前请求 [英] Why Postman and Fiddler never generate preflight request

查看:100
本文介绍了为什么邮递员和提琴手从不生成飞行前请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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。飞行前请求由浏览器发送,然后发送实际请求以确保启用了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.

这篇关于为什么邮递员和提琴手从不生成飞行前请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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