I'm not getting the actual http headers when making the http post call using Angular 5 common httpClient. I'm passing observe: 'response' in request to get the full response (by default httpClient returns only the body in response).
I want to read the Location value from http header response. I can see that Location is available in response headers using chrome browser network view.
But the same is not available when I read the httpClient response in Angular.
screenshot - console.log:
import {
Component,
OnInit
} from '@angular/core';
import {
HttpClient,
HttpHeaders,
HttpResponse
} from '@angular/common/http';
getData() {
const headers = new HttpHeaders({
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json'
});
const url = 'http://localhost:1003/jaxrs/report/3003/params/';
this.http.post(url, {}, {
headers: headers,
observe: 'response'
})
.subscribe(res => {
console.log(res);
});
}
screenshot - network view
Can someone please help me with this? Thanks in advance.