falconry / falcon

The no-magic web data plane API and microservices framework for Python developers, with a focus on reliability, correctness, and performance at scale.
https://falcon.readthedocs.io/en/stable/
Apache License 2.0
9.53k stars 945 forks source link

Make it easier to format inline Content-Disposition header #1951

Closed vytas7 closed 3 years ago

vytas7 commented 3 years ago

(As requested by @Pachada on Gitter.)

While it's very easy to mark the response content as a downloadable file using resp.downloadable_as, this sets the Content-Disposition header assuming attachment disposition.

In some cases, such as a PDF document meant to be viewed inline, this is not optimal. The user could format the header on their own, but then they would have to reimplement resp.downloadable_as's machinery for encoding non-ASCII filenames as per RFC 6266 recommendations.