Hal*_*ter 14 c# http-headers angularjs
我有类似于以下代码domain.com:
$http.post("http://api.domain.com/Controller/Method",
JSON.stringify(data),
{
headers: {
'Content-Type': 'application/json'
}
})
.then(function (response) {
console.log(response);
}, function (response) {
// something went wrong
});
}
Run Code Online (Sandbox Code Playgroud)
它与我的.NET API很好地通信.response.data拥有我的服务器需要给我的所有数据.但是我们有一个新的安全令牌,我们从API传递给客户端,我们将它传递回数据包头中的客户端.我知道令牌正在传回,因为我可以在chrome调试器的网络选项卡上的数据包中读取它.但是response.headers()只包含content-type:"application/json; charset=utf-8"它没有包中的内容.有谁有想法?
这样的数据从API返回(C#)
HttpContext.Current.Response.AppendHeader("session",Guid.NewGuid().ToString());
所以我希望response有一个标题session,但它没有.然而它在数据包中.
Muh*_*ine 13
成功使用headers变量和错误回调
$http.get('/url').
success(function(data, status, headers, config) {
//things to do
})
.error(function(data, status, headers, config) {
//things to do
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
817 次 |
| 最近记录: |