title: Angular 6 - Modifying response body in interceptor not working
body: <p>I have a problem how to modify the response body with <code>HttpInterceptor</code>. Here is my code:</p>
  
  <pre><code>    return next.handle(modifiedReq).pipe(tap((event: HttpEvent&lt;any&gt;) =&gt; {
          if (event instanceof HttpResponse) {
              return event.clone({ body: this.modifyBody(event.body) });
          }
          return event;
      }, error =&gt; {
          this.modifyError(error);
          return of(error);
      }));
  
      private modifyBody(body: any) {
          //modify body here and return it
      }
  </code></pre>
  
  <p>The Interceptor is being called but unfortunately the event body is still the same after it's being modified. At <code>return event;</code> the event object has my modified body but when I jump with debugging a step forward I can see that the event is the origin one and also my services aren't working cause the expected modified body is the origin one. </p>
  
  <p>I just tried to modifiy the event by changing is body like this:</p>
  
  <pre><code>event.body = this.modifyBody(event.body);
  </code></pre>
  
  <p>This actually works but I got an error in the angular CLI because the body-property is a constant and also in the officialy anuglar tutorials they always make clones like in my case.</p>
  
  <p>So does anyone has a similiar problem or can give me any advice how to proceed here?</p>