From 5dda080cdfa2947ed1f677811b560f3087fba203 Mon Sep 17 00:00:00 2001 From: Vytautas Liuolia Date: Sun, 4 Jun 2023 11:05:15 +0200 Subject: [PATCH] feat(static): add static media type mapping for `.mjs` --- falcon/constants.py | 2 ++ tests/test_response.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/falcon/constants.py b/falcon/constants.py index 24057f2b7..9bd71f373 100644 --- a/falcon/constants.py +++ b/falcon/constants.py @@ -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), diff --git a/tests/test_response.py b/tests/test_response.py index 1116be3a3..fe2b73d93 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -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'