我无法连接到behance API。我注册了我的应用程序,获得了我的 API 密钥。当我在浏览器 URL 栏中尝试时,一切正常:
但是每当我尝试通过我的应用程序获取它时,它什么都不返回(响应的主体是空的):
fetch(`https://api.behance.net/v2/projects?client_id=${API_KEY}`, {
mode: 'no-cors'
})
.then((res) => res.json())
.then((data) => {
console.log('DATA ', data)
})
Uncaught (in promise) SyntaxError: Unexpected end of input
at line 63 index.js
第 63 行对应于.then((res) => res.json())
哪个有意义,因为响应是空的。
我也有这个警告(我猜这是因为响应体也是空的):
Cross-Origin Read Blocking (CORB) blocked cross-origin response https://api.behance.net/v2/projects?per_page=25&client_id=[API_KEY] with MIME type application/json. See https://www.chromestatus.com/feature/5629709824032768 for more details.
提前致谢