Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Lib/mimetypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ def _default_mime_types():
'.mht' : 'message/rfc822',
'.mhtml' : 'message/rfc822',
'.mif' : 'application/x-mif',
'.mjs' : 'text/javascript',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be application/javascript for consistency with .js

Copy link

@mathiasbynens mathiasbynens Oct 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

text/javascript is correct, and .js should be changed to use it as well. Please see the discussion above. #3908 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asveltov's rationale for application/javascript is explained here: https://bugs.python.org/issue34875

Copy link

@mathiasbynens mathiasbynens Oct 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you be open to adding .mjs support with application/javascript until https://datatracker.ietf.org/doc/draft-ietf-dispatch-javascript-mjs/ gets officially accepted? It would be better to have some support than to have none at all, given that people are already running into issues with SimpleHTTPServer.

Note that Google Chrome already explicitly supports mjs: https://chromium-review.googlesource.com/c/chromium/src/+/1117070 (with text/javascript)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reading this, it sounds like you are open to that. That’s great! I look forward to Python supporting mjs, and eventually serving it as text/javascript.

'.mov' : 'video/quicktime',
'.movie' : 'video/x-sgi-movie',
'.mp2' : 'audio/mpeg',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Add mimetype for file extension ``.mjs``. This will allow ``python -m`` to
support applications attempting to load ECMAScript Modules with the ``.mjs``
extension.