简体   繁体   English

为什么axios发送两个请求

[英]why Axios send two request

I need help with axios, I don't know why is sending two request here an image of chrome network in one post call我需要有关 axios 的帮助,我不知道为什么在一次通话中向此处发送两个请求,一张 chrome 网络的图像

I'm using react, and when I send request the function only trigger once (I debugged and put console.logs and get one response) but in chrome network I got two request, with different headers and type.我正在使用 react,当我发送请求时,该函数只触发一次(我调试并放置了 console.logs 并得到一个响应),但在 chrome 网络中,我收到了两个请求,具有不同的标头和类型。 One have Authorization token, and the other don't have token success request and wrong request this is in one call and I don't know what is happening.一个有授权令牌,另一个没有令牌成功请求错误请求,这是在一次调用中,我不知道发生了什么。

Thanks for your time!谢谢你的时间!

Is it an OPTION request?它是一个OPTION 请求吗? . . OPTION requests are used to check if your client has permission to make the desired request to the API. OPTION请求用于检查您的客户端是否有权向 API 发出所需的请求。

The HTTP OPTIONS method requests permitted communication options for a given URL or server. HTTP OPTIONS 方法为给定的 URL 或服务器请求允许的通信选项。 A client can specify a URL with this method, or an asterisk (*) to refer to the entire server.客户端可以使用此方法指定 URL,或使用星号 (*) 来引用整个服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM