【问题标题】:In Angular4 HttpClient.get , none of the custom headers returned back在 Angular4 HttpClient.get 中,没有任何自定义标头返回
【发布时间】:2017-10-05 02:28:54
【问题描述】:

我的后端是spring boot 1.5.7,前端是angular4.4.3,

响应不包括所有标头实际上它仅包括缓存控制、内容类型、编译指示和过期 而自定义标题不存在并且同时邮递员显示所有其他标题都已返回

constructor(private http2: HttpClient) { }   
listAll{ this.http2.get<ItemsResponse>('http://mysite:8080' , {observe: 'response'}).subscribe(resp => {
console.log(resp.headers.get('xyz'));
console.log(resp.body.response);
}
);

【问题讨论】:

    标签: angular spring-boot httpclient custom-headers


    【解决方案1】:

    您是否允许/在服务器上使用 CORS 公开这些标头?

    【讨论】:

      猜你喜欢
      • 2018-03-06
      • 1970-01-01
      • 2020-10-27
      • 1970-01-01
      • 1970-01-01
      • 2019-08-27
      • 1970-01-01
      • 1970-01-01
      • 2011-01-04
      相关资源
      最近更新 更多