-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hola, estoy utilizando tu librería para acceder a la API de Andreani y encontré un problema al descargar el PDF de las etiquetas. Aparentemente axios rompe el contenido cuando se trata de un archivo binario. Para solucionarlo hay que agregar este atributo a las opciones:
responseType: 'arraybuffer'
Un fix sería modificar getReq para recibir un parámetro opcional que indique si la respuesta a recibir es un binario:
private async getReq(url: string, binary: string = false) {
const binaryConfigAuth = () => {
let result = this.configAuth;
const cfg = {...result, responseType: 'arraybuffer'};
return cfg;
}
const auth = binary ? binaryConfigAuth() : this.configAuth;
return await axios.get(url, auth).then((x) => x.data);
}
Y modificar el método que busca las etiquetas para que pase el parámetro:
private async $obtenerEtiqueta(remito: string) {
return await this.getReq(this.OBT_ETQ_URL(remito), true);
}
Saludos,
Metadata
Metadata
Assignees
Labels
No labels