我在 Nodejs 中制作了 API,登录后我x-auth
在成功登录的响应中发送 auth-token(标头)。
当我从邮递员那里点击网络服务时,我可以看到x-auth
标题但在 Angular 4中看不到
我正在使用 HttpClient ,而不是 Http。
createClient(client:Client){
return this.http.post(
Config.baseUrl+'/client/login',client,{observe:'response'});
}
然后在我的组件中
this.userService.createClient(this.signupForm.value).subscribe((data)=>{
this.clientCreatedSuccessfully = true;
console.log(data);
console.log(data.headers.getAll('x-auth'));
},(error)=>{
this.clientExist = true;
console.log(error);
})
data.headers.getAll('x-auth')
返回 Null 。