Check non-angular http status

1

I have the following code, I need to check the status that the server returns to WebApp, I have the following code:

this.http.post (this.url,json) 

    .subscribe ( 
          res => { 
            console.log(res);
          }, 
          (err: any) => { 
            console.log('raw error =>', err);
          } 
        );}
    
asked by anonymous 26.12.2018 / 18:46

1 answer

0

Do this:

this.http.post (this.url,json, {observe: 'response'})     
    .subscribe ( 
          res => { 
            console.log(res);
            console.log(res.status);
          }, 
          (err: any) => { 
            console.log('raw error =>', err);
          } 
        );}
    
26.12.2018 / 18:52