swagger-angular-generator
swagger-angular-generator copied to clipboard
Blob responsetype error
I have a method that expects type blob. Intead what's generated is this
exportvalues(params: ExportvaluesParams): Observable<blob> {
const pathParams = {
id: params.id,
};
return this.http.get<blob>(`/api/dimensions/${pathParams.id}/exportvalues`);
}
Which gives the error that blob don't exist.
Here is an example correct implementation:
GetExportValuesResponse(id: number): __Observable<__StrictHttpResponse<any>> {
let __params = this.newParams();
let __headers = new HttpHeaders();
let __body: any = null;
let req = new HttpRequest<any>(
'GET',
this.rootUrl + `/api/dimensions/${id}/exportvalues`,
__body,
{
headers: __headers,
params: __params,
responseType: 'blob'
});
return this.http.request<any>(req).pipe(
__filter(_r => _r instanceof HttpResponse),
__map((_r) => {
return _r as __StrictHttpResponse<any>;
})
);
}
TL;DR: Use <any>
and responseType: 'blob'
Note: I've found that "blob" is not part of the Swagger spec. However, "file" accomplishes the same thing.