【问题标题】:Can not find Custom HTTP Response headers in Angular 4.4.0-RC.0在 Angular 4.4.0-RC.0 中找不到自定义 HTTP 响应标头
【发布时间】:2017-12-07 20:18:20
【问题描述】:

我正在尝试从客户端发送一些自定义 HTTP 标头,以便我可以了解问题的原因并向用户显示正确的消息。我无法从下面的代码中获取响应头(它显示为空)。

this.myService.getAllUsers().subscribe(results => {
    console.log(results)
},
error => {
    console.log(error.headers.get("ErrorCode"));            
});

但是从浏览器(chrome)我可以看到响应中有标题。 Look at the image here

我期待看到值“INVALID_SESSION”作为控制台输出。

但改为 null 。有人可以帮忙吗?

【问题讨论】:

  • 你的errorobject看起来像json?

标签: angular rxjs angular-http


【解决方案1】:
猜你喜欢
  • 2017-12-10
  • 1970-01-01
  • 2018-09-26
  • 2020-10-22
  • 2018-08-11
  • 1970-01-01
  • 2015-01-24
  • 1970-01-01
  • 2016-05-27
相关资源
最近更新 更多