Angular 4 Http Interceptor: next.handle(...).do is not a function Angular 4 Http Interceptor: next.handle(...).do is not a function angular angular

Angular 4 Http Interceptor: next.handle(...).do is not a function


This error is thrown because you are missing the do operator. The below import with patch the observable object with the do operator.

import 'rxjs/add/operator/do';

RxJs does not come bundled with all the operator functions by default to reduce the library size. You are required to import the operators you would like to use individually.


rxjs 6 / angular 6 will need the pipe

return next.handle(req).pipe(  tap(event => {    if (event instanceof HttpResponse) {      ...    }  }));


You have to use import.

import 'rxjs/add/operator/do';import 'rxjs/add/operator/catch';import 'rxjs/Observable';import 'rxjs/add/observable/throw';