Javascript 使用基本身份验证时出现错误404
我试图使用Fetch进行GET查询,但在传递授权时出现错误404。Javascript 使用基本身份验证时出现错误404,javascript,ajax,http-headers,authorization,fetch-api,Javascript,Ajax,Http Headers,Authorization,Fetch Api,我试图使用Fetch进行GET查询,但在传递授权时出现错误404。 我不知道为什么会发生这种错误,因为当我使用诸如Postman之类的工具时,服务器响应良好 Authorization: Basic ... method: GET url: https://zammad.zonngo.com/api/v1/ticket_articles 当我使用Javascript获取API时,出现错误404 OPTIONS https://zammad.zonngo.com/api/v1/ticket_ar
我不知道为什么会发生这种错误,因为当我使用诸如Postman之类的工具时,服务器响应良好
Authorization: Basic ...
method: GET
url: https://zammad.zonngo.com/api/v1/ticket_articles
当我使用Javascript获取API
时,出现错误404
OPTIONS https://zammad.zonngo.com/api/v1/ticket_articles 404 (Not Found)
这是我的密码:
const myHeaders = new Headers();
myHeaders.append('Authorization','Basic ...');
myHeaders.append('Content-Type','application/json');
fetch(URLTICKETS, {
method: 'GET',
headers: myHeaders
})
.then(response => {
console.log(response);
})
.then(error => {
console.log(error);
});
如果有人能帮助我,那就太好了。URL上的
GET
方法返回401状态码,但是选项方法实际上返回404
http OPTIONS https://zammad.zonngo.com/api/v1/ticket_articles
HTTP/1.1 404 Not Found
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html; charset=UTF-8
Date: Thu, 02 Nov 2017 01:37:59 GMT
Server: nginx/1.10.3 (Ubuntu)
Transfer-Encoding: chunked
X-Request-Id: 16f58319-2658-4b0e-824c-08ca68e8d401
X-Runtime: 0.003135
选项
可能是由于https://zammad.zonngo.com/
URL上的GET
方法返回401状态代码,但OPTIONS
方法实际返回404
http OPTIONS https://zammad.zonngo.com/api/v1/ticket_articles
HTTP/1.1 404 Not Found
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html; charset=UTF-8
Date: Thu, 02 Nov 2017 01:37:59 GMT
Server: nginx/1.10.3 (Ubuntu)
Transfer-Encoding: chunked
X-Request-Id: 16f58319-2658-4b0e-824c-08ca68e8d401
X-Runtime: 0.003135
选项
可能是由于https://zammad.zonngo.com/