I'm using the code below to try to extract a value (ReturnStatus) from the response headers;
Keep-Alive: timeout=5, max=100
ReturnStatus: OK,SO304545
Server: Apache/2.4.29 (Win32) OpenSSL/1.0.2m
The code;
import { Injectable } from '@angular/core';
import { Account } from './model/account';
import { HttpClient } from '@angular/common/http';
import { Observable, throwError } from "rxjs";
import { map, filter, catchError, mergeMap } from 'rxjs/operators';
createOrder(url) : Observable<any> {
return this._http.get(url, {withCredentials: true, observe: 'response'})
.pipe(
map((resp: any) => {
console.log("response", resp);
return resp;
}), catchError( error => {
console.log("createOrder error",error );
alert("Create Order Service returned an error. See server log for mote details");
return throwError("createOrder: " + error)
})
);
}
However my console.log just give;
HttpResponse {headers: HttpHeaders, status: 200, statusText: "OK", url:
"http://localhost/cgi-bin/dug.cgi/wh?Page…
plateLocation=C:%5Ctemp%5Corderimporttemplate.txt", ok: true, …}
I've looked on this site and others for the correct way to do this in Angular but to no avail? Could someone point me in the right direction please?
Many thanks,
Mark.