Receive files instead of json objects
Gaedr opened this issue · 2 comments
I want to create a resource to obtain a file from a backend like csv or pdf.
I've trying to use a modify Resource class to obtain the content and transform to Blob object to save the file. But no matter I do the response always transform the result into an JSON object.
I try with this ResourceAction:
@ResourceAction({
method: RequestMethod.Get,
path: 'reporte/',
responseInterceptor: (observable: Observable<any>) => {
return observable.map(res => res._body ? res._body : null);
},
map: (res) => {
console.debug(res);
return res;
}
})
informe: ResourceMethod<IQueryInforme, any>;
In this map property I write the response and all it is ok but when I subscript the observable it is parse to JSON object and transform every character into a property. Like that:
{0: "i", 1: "d", 2: "|", 3: "n", 4: "o", 5: "m", 6: "b", 7: "r", ... }
I know this is possible with the Http library of angular but I cannot get it with this library.
Is possible to do that with the library? If it is, please show me how
Hello @Gaedr
It's not possible to download files with the library.
Is this true anymore? Can't we override an Action's reponseType now?