Angular JS HTTP Response标头无法在Safari上运行

问题描述 投票:1回答:1

我遇到了一个问题,我发布了一个对象,作为回应,我应该从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
angularjs safari http-headers httpresponse
1个回答
0
投票

也许你的safari是旧的版本,根据旧的建议工作,每个自定义标题必须以X为前缀 - 请参阅此链接:enter link description here

© www.soinside.com 2019 - 2024. All rights reserved.