我遇到了一个问题,我发布了一个对象,作为回应,我应该从HTTP响应中获取一些标头。问题是这个代码在Chrome,Firefox,IE等浏览器中运行良好,但在Safari(Windows)的情况下返回null
。
$http.post(url, data)
.then(function(response){
console.log(response.headers("location"));
// response.headers("location") is null in Safari
});
以下是我从服务器获取的响应标头。
Access-Control-Allow-Credentials:true
Access-Control-Allow-Origin:http://localhost:5000
Access-Control-Expose-Headers:ETag,Location
Content-Length:0
Date:Mon, 15 May 2017 12:46:14 GMT
Location: //my API
Server:Microsoft-IIS/8.5
X-Powered-By:ASP.NET