You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add content_type flag to Sanic.static
Fixes#1266
* Fix flake8 error in travis
Add line to document `content_type` arg
* Fix content_type for file streams
Update tests
herp derp
* Remove content_type as an arg to HTTPResponse
`response.HTTPResponse` will default to `headers['Content-Type']` instead of `content_type`
#1267 (comment)
While trying to serve a utf-8 encoded HTML document via
Sanic.static
, I noticed thatcontent_type
cannot be set usingSanic.static
.Sanic
header content_type defaults totext/plain
if the type cannot be guessed by
mime_types.guess_type
, which seems to only analyze the filename.Currently, the following is not possible (same goes for blueprints):
Prior to this PR, you need to do the following to serve a document with a custom content-type:
I'll be submitting a PR shortly with a proposed fix.
The text was updated successfully, but these errors were encountered: