Azure / api-management-developer-portal

Developer portal provided by the Azure API Management service.
MIT License
479 stars 307 forks source link

Support downloading excel and csv responses with content disposition attachment header #2274

Open LauraXiulan opened 10 months ago

LauraXiulan commented 10 months ago

When retrieving an CSV or EXCEL file as response in the Developer Portal, the response is shown inline, which makes it unreadable. This PR adds logic to download these kinds of responses instead.

Suggestions, remarks and edits are welcome. I tested the code locally for our own APIM by temporary switching to Self-Hosted. I have only added CSV and EXCEL in this PR, but I can imagine a usecase for PDF's as well.

LauraXiulan commented 10 months ago

@microsoft-github-policy-service agree

LauraXiulan commented 10 months ago

1984

LauraXiulan commented 8 months ago

@ygrik @malincrist @azaslonov

verschaevesiebe commented 5 months ago

Nice addition, we sometimes have the intent to download other content types. Eg. a very large JSON file for example. Would you be able to include a similar feature for attachment disposition types where filenames are json or by means any text formal is applicable ?

E.g xml, text, json, jsonc, etc ...

header('Content-Disposition: attachment; filename=data.json'); header('Content-Type: application/json');

Would be amazing thanks !