【发布时间】:2021-03-20 05:39:25
【问题描述】:
我有一个 react 应用程序,我可以在其中将图像上传到 imgur,例如:
const formData = new FormData();
formData.append('image', file);
return fetch('https://api.imgur.com/3/image/', {
method: 'POST',
headers: { Authorization: 'Client-ID xxxxxxxxxxxxx' },
body: formData,
})
我以前可以从本地主机上传图片,但现在当我运行相同的代码时,我得到了:
Access to fetch at 'https://api.imgur.com/3/image/' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
这是否意味着 imgur 更新了他们的 CORS 政策?
【问题讨论】:
标签: javascript frontend imgur