I'm not using HttpIntercepter in my Angular project and I want to retrieve some custom Response Headers in case of error. I tried { observe: 'response' }
in my POST API call:
post(url, data = ''): Observable<any> {
url = this.baseApiUrl + url;
const headers = this.createHttpHeaders();
const body = JSON.stringify(data);
return this.http.post(url, body, {headers: headers, observe: 'response'}).pipe(catchError(HttpClientHelper.handleError));
}
but I'm receiving only 4 headers:
error.headers.keys().map( (key) => console.log(key + ':' + error.headers.get(key)));
returns
cache-control: no-cache, no-store, max-age=0, must-revalidate
content-length: 0
expires: 0
pragma: no-cache
But, custom response headers with prefix x-
are not returned. Is there any configuration to retrive custom response headers?