Skip to content

Commit

Permalink
feat(static): add static media type mapping for .mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
vytas7 committed Jun 4, 2023
1 parent 30f90b5 commit 5dda080
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions falcon/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@
('.jpeg', MEDIA_JPEG),
('.jpg', MEDIA_JPEG),
('.js', MEDIA_JS),
('.json', MEDIA_JSON),
('.mjs', MEDIA_JS),
('.png', MEDIA_PNG),
('.txt', MEDIA_TEXT),
('.xml', MEDIA_XML),
Expand Down
6 changes: 6 additions & 0 deletions tests/test_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,14 @@ def test_response_option_mimetype_init(monkeypatch):
ro = ResponseOptions()

assert ro.static_media_types['.js'] == 'text/javascript'
assert ro.static_media_types['.json'] == 'application/json'
assert ro.static_media_types['.mjs'] == 'text/javascript'

mock.reset_mock()
mock.inited = True
ro = ResponseOptions()
mock.init.assert_not_called()

assert ro.static_media_types['.js'] == 'text/javascript'
assert ro.static_media_types['.json'] == 'application/json'
assert ro.static_media_types['.mjs'] == 'text/javascript'

0 comments on commit 5dda080

Please sign in to comment.