Axios被分配给直接从node_modules导入的Vue.prototype,如下所示:
import axios from "axios";
import Vue from "vue"
Vue.prototype.axios = axios;
每次浏览器发送请求时,connection: keep-alive
都是可用的。
有没有办法去掉报头?
axios.defaults.headers.common
中可用的默认标头为
{
Accept: "application/json, text/plain, */*
}
发布于 2020-04-08 20:52:52
如果你看一下documentation for the Connection-header,它被归类为"Forbidden header name“。
这基本上意味着它们是由浏览器处理的,不能被代码更改。
对于Referer和Cookie这样的其他头部也是如此(整个列表可以在https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name上找到)。
https://stackoverflow.com/questions/61100551
复制相似问题