Man*_*m V 6 reactjs reactjs-flux
下面的代码不起作用并返回 403 forbidden 但相同的 url 提供了正确的响应邮递员工具。
fetch('https://example.com/', {
method: 'POST',
headers: {'Content-Type': 'application/json', },
body:JSON.stringify(sampledata),
}).then(result => console.log('success====:', result))
.catch(error => console.log('error============:', error));
Run Code Online (Sandbox Code Playgroud)
您需要在您的请求中添加凭据:'include'。
fetch('https://example.com/', {
credentials: 'include',
method: 'POST',
headers: {'Content-Type': 'application/json', },
body: JSON.stringify(sampledata),
}).then(result => console.log('success====:', result))
.catch(error => console.log('error============:', error));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
25855 次 |
| 最近记录: |