Why does Fetch API Send the first PUT request as OPTIONS

后端 未结 1 695
花落未央
花落未央 2020-12-02 02:49

I am trying to make a cors PUT request using the vanilla Fetch API

When I click my button to send the PUT request, the method on the first request is

1条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-02 03:18

    See the 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.

    at steps 1 through 7; also 4.8. CORS-preflight cache.

    0 讨论(0)
提交回复
热议问题