fetch request to conduct post Why will first send a request options?

Just fetch, as long as you meet the following situations, will go to initiate a Preflighted requests, the request is options, see the link above.

It uses methods other than GET, HEAD or POST. Also, if POST is used to send request data with a Content-Type other than application / x-www-form-urlencoded, multipart / form-data, ortext / plain, eg if POST Request SENDS AN XML at The payload to a using the Application at The Server / xmlor text / xml, the then iS at The Request preflighted.
It sets Custom headers in at The Request (EG at The Request A uses the X-header SUCH AS-PINGOTHER)

you see if you are not one of the bar to trigger these conditions, when the browser will initiate cross-domain requests with a `Origin` header, it is actually a custom headers, then there would be a first trigger requests preflighted,
Fetch Standard also mentioned.
---------------------
Author: playing piano
Source: CSDN
Original: https: //blog.csdn.net/bbsyi/article/details/79023655
Copyright: This article is a blogger original article, reproduced, please attach Bowen link!

Guess you like

Origin www.cnblogs.com/gao88/p/11260777.html