为什么 Fetch API 发送第一个 PUT 请求作为 OPTIONS
Why does Fetch API Send the first PUT request as OPTIONS
我正在尝试使用原版 Fetch API
发出 cors
PUT 请求
当我点击我的按钮发送PUT请求时,第一个请求的方法是OPTIONS
。只有当我再次点击按钮时,请求上的方法才变为 PUT
。为什么?
我知道这是 CORS 预检的一部分,但是有没有办法手动触发预检以便缓存 OPTIONS 响应?
这种行为是否表明某个地方的承诺失败了?
参见Fetch Standard, section 4.7. CORS-preflight fetch。
Note: This is effectively the user agent implementation of the check to see if the CORS protocol is understood. The so-called CORS-preflight request. If successful it populates the CORS-preflight cache to minimize the number of these fetches.
在第 1 步到第 7 步;还有 4.8. CORS-preflight cache.
我正在尝试使用原版 Fetch API
发出cors
PUT 请求
当我点击我的按钮发送PUT请求时,第一个请求的方法是OPTIONS
。只有当我再次点击按钮时,请求上的方法才变为 PUT
。为什么?
我知道这是 CORS 预检的一部分,但是有没有办法手动触发预检以便缓存 OPTIONS 响应?
这种行为是否表明某个地方的承诺失败了?
参见Fetch Standard, section 4.7. CORS-preflight fetch。
Note: This is effectively the user agent implementation of the check to see if the CORS protocol is understood. The so-called CORS-preflight request. If successful it populates the CORS-preflight cache to minimize the number of these fetches.
在第 1 步到第 7 步;还有 4.8. CORS-preflight cache.