我尝试通过$ http提供程序访问响应标头但没有成功。在我的研究中,我读到这是一个CORS问题。但这没有任何意义,因为阅读GoogleChrome检查器(网络部分)中的标题,标题就在那里。代码:
$http({
method: 'POST',
"url" : url,
"headers":{
"Content-Type":"application/json",
"Ocp-Apim-Subscription-Key":"<SECRETKEY>"
},
"data": {"video":fileData}
}).then(
function successCallback(res){
console.log("SUCCESS!");
console.log("RESPONSE JSON ON SERVICE: " + JSON.stringify( res ) );
console.log("HTTP HEADERS" + JSON.stringify($http.headers) );
sucxCallback(res.headers);//this came undefined...
}
,function errorCallback(res){
console.log("FAIL!")
}
);
我能做些什么?我正在考虑将$ http更改为$ ajax。替代?
THX!