これはテストできます。ワーキング。あなたに体の要求とURLを与えるでしょう。
this.http.post(url, body, this.options).subscribe(
data => {
console.log('ok url:' + url);
console.log('body:' + JSON.stringify(body));
},
(err: HttpErrorResponse) => {
if (err.error instanceof Error) {
// A client-side or network error occurred. Handle it accordingly.
console.log('instanceof error url:' + url);
console.log('body:' + JSON.stringify(body));
console.log('An error occurred:', err.error.message);
} else {
// The backend returned an unsuccessful response code.
// The response body may contain clues as to what went wrong,
console.log('backend error url:' + url:' + url);
console.log('body:' + JSON.stringify(body));
let strBody = JSON.stringify(err);
strBody = JSON.stringify(err.error);
strBody = JSON.stringify(err.status);
console.log(`Backend returned code ${err.status}, body was: ${err.error}`);
}
}
);