0
I have to apply a descriptografia on the return body of a request via Interceptor, but the method of decryption is asynchronous and returns a promisse.
Follow a section of the class:
intercept(req: HttpRequest, next: HttpHandler): Observable> {
return next.handle(req).pipe(map((event: HttpEvent<any>) => {
  if (event instanceof HttpResponse) {
    let _body;
    this.cryptMethod.decrypt(event.body).this(res => _body = res); // Método assíncrono
    return event.clone({ body: JSON.parse(_body) });
  }
  return event;
}));
}`
It turns out that the this.cryptMethod.decrypt() is asynchronous, so Return is reached before _body is filled.
Is there any solution to this?
Thanks man, it worked here! Thanks!
– Anselmo Júnior