I am using Angular 2.2.3 and doing http requests with observables with rxjs. The headers appear in the Chrome console, but the list of headers on the headers object from the response is empty.
Here is the code :
Login function
login(body: Object): Observable<Response> {
return this.http.post(this.url, body);
}
Call of login function with subscription to the observable
this.authService.login(values).subscribe(res => {
console.log(res.headers.get("Authorization"))
console.log(res)
},
err => {
console.log(err);
});
Is there something I am doing wrong or that I should do differently?
Chrome network console response headers
Console.log results
The null
value is res.headers.get("Authorization")
As you can see, the headers list is empty.
Thank you very much for your help!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…