Open MattyCZ opened 3 months ago
Hi, this has come up before years ago. For some reason browsers don't like to display yaml files. Chrome for example has no issues showing json, but always downloads the yaml. The inline
disposition was to coerce the browser to render the schema and in case of download give it a sensible filename.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
Also I just noticed that the schema?format=json
has stopped working somehow.
https://github.com/tfranzel/drf-spectacular/pull/607 https://github.com/tfranzel/drf-spectacular/pull/621
In general, I am not sure how to massage the response so that browsers are happy with it. Please feel free to investigate better handling and we can come up with a better solution if possible.
Describe the bug If I put SpectacularAPIView the view downloads the yaml file instead of showing it inline
To Reproduce urls.py
open at localhost:8000/docs/api/swagger.yaml, file gets downloaded instead of shown inside browser Tested on chrome Version 128.0.6613.84 (Official Build) (64-bit) Firefox 128.0.3 (64-bit)
Expected behavior Documentation yaml file is opened in browser instead of downloaded into the system
This might be bug in the browsers, because when I use curl -I, the Content-Disposition: inline header is present in the response