Hello everyone,
I know through the documentation how to get the status code and content of an HTTP Response. However, what I want to know if there is a way to separate Successful HTTP Request (2xx) from the Unsuccessful one(4xx or 5xx). Similarly how it is handled in Angular + Typescript:
HTTPrequest.subscribe((response) => {
// successful code
}, (error) => {
// Unsuccessful code
});
Sure, I could get the code from the request and check whether it is a 2xx code, but just wanted to make sure if this behavior already exist in order to avoid repetition.