- options请求就是预检请求,可用于检测服务器允许的http方法。
- 当发起跨域请求时,由于安全原因,触发一定条件时浏览器会在正式请求之前自动先发起OPTIONS请求(cors预检请求)
- 服务器若接受该跨域请求,浏览器才继续发起正式请求
- 简单请求:请求方式为get、head、post时的请求
- 复杂请求:put、delete、connect、options、trace、patch
option预请求
最新推荐文章于 2024-08-23 16:40:31 发布
OPTIONS请求是跨域资源分享(CORS)机制的一部分,用于在实际请求前检查服务器是否允许特定的HTTP方法。当发起非简单请求(如PUT、DELETE等)时,浏览器会自动发送预检请求,等待服务器批准后才会执行实际操作。简单请求则限于GET、HEAD和POST这些方法。
摘要由CSDN通过智能技术生成