I am making a web service call in Angular 5, using the HttpClientModule, and it works for all 200 statuses response. But, if there is any 400 statuses it just waits and waits and waits and eventually get a 503 status.
For example, if I call this function with correct username/password, it works, I get 200 status back, and the User object. But, if I pass in incorrect username/password, I dont get the 400 error, I get a 503 error after about a minute.
The server side log shows that the webservice is returning a 400 status to my request, but nothing comes back.
Here is my web service call code:
login(username: string, password: string): Observable<boolean> {
const url = this.getUrl('/v1/users/login');
const headers = {
headers: new HttpHeaders({'Content-Type': 'application/json', 'transactionId': uuid.v4()})
};
const body = { username, password };
return new Observable<boolean>( observer => {
this.http.post<User>(url, body, headers).subscribe(
(user: User) => {
console.log('login: Success: ', user);
observer.next(true);
},
(err: HttpErrorResponse) => {
console.log('login: Error: ', err);
observer.next(false);
}
);
});
}
Here is the Chrome Network log: