Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/450.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用基本身份验证时出现错误404_Javascript_Ajax_Http Headers_Authorization_Fetch Api - Fatal编程技术网

Javascript 使用基本身份验证时出现错误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

我试图使用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_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/