我尝试使用带有头文件身份验证的提取来从localhost发布一个对象 (python -m SimpleHTTPServer)。
proxyurl:CORS Anywhere是一个代理,它将CORS标头添加到代理请求
var proxyurl = "https://cors-anywhere.herokuapp.com/";
//Public Development Server
url = 'https://public.coindaddy.io:14001/api/',
auth = 'rpc:1234';
var settings = {
"crossDomain": false,
"method": "POST",
timeout: 60000, // timeout after 60 seconds of waiting
"headers": {
"authorization": "Basic " + auth,
"Content-Type": 'application/json; charset=UTF-8',
}
fetch(proxyurl+url,settings ).then(response => console.log('Success:', response));
}
请求总是因HTTP状态401而失败 任何解决方案?