我需要 axios 方面的帮助,我不知道为什么要发送两个请求 here an image of chrome network在一个电话后
我正在使用 React,当我发送请求时,该函数仅触发一次(我调试并放置 console.logs 并获得一个响应)但在 chrome 网络中我收到两个请求,具有不同的 header 和类型。 一个有授权 token ,另一个没有 token success request和 wrong request这是一个电话,我不知道发生了什么。
感谢您的宝贵时间!
最佳答案
它是 OPTION request? 吗? . OPTION
请求用于检查您的客户端是否有权向 API 发出所需的请求。
The HTTP OPTIONS method requests permitted communication options for a given URL or server. A client can specify a URL with this method, or an asterisk (*) to refer to the entire server.
关于javascript - 为什么axios发送两个请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64697829/