Estoy usando un BFF como proxy.
Necesito obtener un archivo de Excel (y pdf) del servidor y reenviarlo para descargarlo desde la aplicación frontal (que usa reactjs).
El código:
monthlyGet(): Observable<AxiosResponse<any>> { const req: Request = RequestContext.currentContext.req; const headers = req.headers as AxiosRequestHeaders; const api = this.configService.get<string>('REPORTS_API'); const path = req.path; const query = req.url.split('?')[1]; const url = `${api}${path}${query ? `?${query}` : ''}`; delete headers.host; return this.httpService .get(url, { headers }) .pipe( catchError((e) => { throw new HttpException(e.response?.data, e.response?.status || 500); }), ) .pipe(map((response) => response.data)); }El resultado es un archivo dañado.
He intentado varias formas usando stream, buffer... sin éxito.