I am trying to get the value of Header Response enter image description here"Location" after a post 201 method, I want to get that result and send it as a variable to another api post
public saveNote(note: any): Observable\<any\> {
return this.http.post\<any\>(
this.apiURL + '/contract/api/notes/' + Location,
JSON.stringify(note),
this.httpOptions,
)
.pipe(retry(1), catchError(this.handleError));
}
How can I do it? I'm already lost thanks for your help
In Contractadd.ts
return this.restApi.post(this.contract, body, options)
.flatMap((res:Response) => {
var location = res.headers.get('Location');
return this._http.get(location);
}).map((res:Response) => res.json()))
.catch(this.handleError)
Get errors in code TS
In service.ts
Access-Control-Allow-Headers:location