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'