Download a file from API

Adding my own comment here with new findings on this case.
The issue seems to be caused by the content-type header. If the content-type header is application/octet-stream then the file downloads correctly. But if its application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, then it fails to download.

It seems that not all standard content-type MIME types are supported…?