# 什么情况下会发送 OPTIONS 请求
Issue
欢迎在 Gtihub Issue 中回答此问题: Issue 363 (opens new window)
Author
搬运地址 (opens new window) 1:请求的方法不是 GET/HEAD/POST 2:POST 请求的 Content-Type 异常 3:请求设置了自定义的 header 字段
Author
当一个请求跨域且不是简单请求时就会发送 OPTIONS
请求
满足以下条件就是一个简单请求:
Method
: 请求的方法是GET
、POST
及HEAD
Header
: 请求头是Content-Type
、Accept-Language
、Content-Language
等Content-Type
: 请求类型是application/x-www-form-urlencoded
、multipart/form-data
或text/plain
而在项目中常见的 Content-Type: application/json
及 Authorization: <token>
为典型的非简单请求,在发送请求时往往会带上 Options
更详细内容请参考 CORS - MDN (opens new window)