我正在尝试使用JQuery调用SonarQube API:
$.ajax({
url: "http://172.31.1.195:9000/api/qualitygates/project_status?projectKey=com.bgzchina.devops:demo-rest-service",
type: "GET",
dataType : "json",
crossDomain: true,
xhrFields: {
withCredentials : true
},
cache : false,
beforeSend : function(xhr){
xhr.setRequestHeader("Authorization", "Basic YWVlZDE4MDUwYjk1MjJiMDFlNWUyNTk3MzBmNjU1ZDc3ZDRjMmQ1MTo=");
},
success : function(data){
console.log(data);
}
})
在REST客户端(例如Advanced Rest Client)中可以毫无问题地访问此API。但是在浏览器中,Jquery ajax调用结果预检请求带有http 405响应代码,是否有任何提示?