Skip to content

Conversation

@JosePineiro
Copy link

Enhances the _setContentTypeFromPath method in AsyncFileResponse to better handle JavaScript MIME types.

Previously, .js files were correctly recognized, but .mjs files (ES modules) were not and defaulted to application/javascript. This enhancement ensures both .js and .mjs files are assigned text/javascript, improving compatibility with modern browsers.

All other MIME type handling remains unchanged. This change enhances robustness and standards compliance of the file server.

Fix the issue #267

Enhances the `_setContentTypeFromPath` method in `AsyncFileResponse` to better handle JavaScript MIME types.  

Previously, `.js` files were correctly recognized, but `.mjs` files (ES modules) were not and defaulted to `application/javascript`. This enhancement ensures both `.js` and `.mjs` files are assigned `text/javascript`, improving compatibility with modern browsers.  

All other MIME type handling remains unchanged. This change enhances robustness and standards compliance of the file server.

Fix the issue ESP32Async#267
@mathieucarbou mathieucarbou merged commit 5668b9c into ESP32Async:main Aug 23, 2025
34 checks passed
@JosePineiro JosePineiro deleted the feat/js-mime-detection branch August 23, 2025 13:57
@mathieucarbou mathieucarbou linked an issue Sep 6, 2025 that may be closed by this pull request
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Request - Add javascript MJS file support.

3 participants