I try to download a file via an angular 2 typescript client. The link generated in Swagger UI works fine, but the generated typescript client does not.
The controller looks like this:
[HttpGet("export")]
[SwaggerResponse((int) HttpStatusCode.OK, Type = typeof(FileContentResult))]
[ProducesResponseType(typeof(FileResult), (int) HttpStatusCode.OK)]
[Produces("text/csv")]
public virtual FileResult Export(int Id, string fileType, CsvFormat format, bool includeHeader)
{
.
.
.
FileStreamResult file = new FileStreamResult(s, "text/csv");
file.FileDownloadName = ts.Name + "." + fileType;
return file;
}
The generated typescript client looks like this. As you can see the responseText is set but never returned. What am I missing?
protected processRestTimeSeriesExportGet(response: Response): Observable<void> {
const status = response.status;
if (status === 200) {
const responseText = response.text();
return Observable.of<void>(<any>null);
} else if (status !== 200 && status !== 204) {
const responseText = response.text();
return throwException("An unexpected server error occurred.", status, responseText);
}
return Observable.of<void>(<any>null);
}
Best regards