Postman 正常,但本地项目 406 (Not Acceptable)
问题: Postman 正常,但本地项目 406 (Not Acceptable)
javascript
return request({//请求头设置
url: ``,
headers: {
'Accept': '*/*',//api要求必须添加
'Content-Type': 'application/json',
},
method: 'POST',
data
})
- 为什么会报 406 错误?
406 Not Acceptable 意味着:服务器无法根据你提供的 Accept 头,返回你想要的数据格式。但在你的情况下,真正的幕后黑手通常是 浏览器的安全策略(Referrer) 或 请求头冲突。

解决问题
1.index.htm里边添加 <meta name="referrer" content="no-referrer">