当我发送带有自定义标头和GET方法的XHR时,我遇到了问题:
我的要求:
var xhr = new XMLHttpRequest()
xhr.open("GET", "http://api.pms.dev/v1/users", true);
xhr.setRequestHeader('Authorization', "Basic " + 'dsfsdfsdfsdfdsf');
xhr.send();
回复机构:
Remote Address:192.168.56.121:80
Request URL:http://api.pms.dev/v1/users
Request Method:OPTIONS
Status Code:401 Unauthorized
Accept:*/*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4,de;q=0.2,it;q=0.2,uk;q=0.2,es;q=0.2
Access-Control-Request-Headers:authorization
Access-Control-Request-Method:GET
Cache-Control:max-age=0
Connection:keep-alive
Host:api.pms.dev
Origin:null
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/34.0.1847.116 Chrome/34.0.1847.116 Safari/537.36