ali*_*hie 7 javascript httprequest http-headers vue.js axios
我正在尝试通过 vue 中的 axios 实例发送请求,但我不知道如何为 'Sec-Fetch-Dest' 、 'Sec-Fetch-Mode' 、 'Sec-Fetch-Site' 和“Sec-Fetch-User”。
axios 文档中没有有关这些标头的信息,并且它们似乎不可编辑。
我尝试自定义和编辑默认的 config.headers 值(例如替换'cross-site'为'none'for 'Sec-Fetch-Site'header),但它不断发送默认值。
这是我在 vue 中的请求代码的示例:
axios.get('http://localhost:4433/some-endpoint/', {
withCredentials: true, // if I set this to false nothing changes
headers: {
'Sec-Fetch-Dest': 'document',
'Sec-Fetch-Mode': "navigate",
'Sec-Fetch-Site': 'none',
'Sec-Fetch-User': '?1'
}
})
.then(res => {console.log('response', res)})
.catch(err => {console.log('error', err)})
Run Code Online (Sandbox Code Playgroud)
但发送请求的标头根本不会改变:
提前致谢 !:)
| 归档时间: |
|
| 查看次数: |
16451 次 |
| 最近记录: |