Skip to content

Request - Add javascript MJS file support. #267

@mrdude2478

Description

@mrdude2478

Platform

ESP32

IDE / Tooling

Arduino (IDE/CLI)

What happened?

Currently javascript files with the extension .mjs are not supported so hosting with mjs files doesn't work. It's easy to fix, only small adjustments to 2 files are needed.

src\literals.h
Add:
static constexpr const char *T__mjs = ".mjs";

src\WebResponses.cpp
Edit From:
else if (strcmp(dot, T__js) == 0) {
    _contentType = T_application_javascript;

Edit To:
else if (strcmp(dot, T__js) == 0 || strcmp(dot, T__mjs) == 0) {
    _contentType = T_application_javascript;

These mods allow .mjs files to be executed properly. I woulld be gratefull if you could add these to be able to support mjs files in future. Thanks.

Stack Trace

No issues with this.

Minimal Reproductible Example (MRE)

Not an issue, a feature request.

I confirm that:

  • I have read the documentation.
  • I have searched for similar discussions.
  • I have searched for similar issues.
  • I have looked at the examples.
  • I have upgraded to the lasted version of ESPAsyncWebServer (and AsyncTCP for ESP32).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions