问题描述
我正在尝试对 memberpress API 端点进行 GET 调用。这在 Postman 和 Python 中都有效,没问题。当我尝试从 Javascript 进行这个看似相同的调用时(并且我从周日开始尝试了六种方法),它始终是 DOA。我得到的只是一个 html 错误代码 0。我错过了什么?
fetch("https://website.com/wp-json/mp/v1/members?search=member",{
headers:{
"Accept": "application/json","content-type": "application/json","Connection": "keep-alive","MEMBERPRESS-API-KEY": "api-key","User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/72.0.3626.121 Safari/537.36"
},credentials: 'same-origin',})
.then((resp) => resp.json())
.then((response) => {
console.log("here");
console.log(response)
})
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)