davidmoreno / onion

C library to create simple HTTP servers and Web Applications.
http://www.coralbits.com/libonion/
Other
2.02k stars 252 forks source link

.mjs suffix should be known for Javascript module files. #247

Closed bstarynk closed 5 years ago

bstarynk commented 5 years ago

The .mjs suffix should be known for JavaScript module files.

Notice that JavaScript modules are today common to most major browsers.

The fix is so trivial that I don't even consider making a formal pull request. It is a one line patch:

diff --git a/src/onion/mime.c b/src/onion/mime.c
index 02eb4e8..ea2925b 100644
--- a/src/onion/mime.c
+++ b/src/onion/mime.c
@@ -104,6 +104,7 @@ static void onion_mime_fill() {
     onion_dict_add(onion_mime_dict, "html", "text/html", 0);
     onion_dict_add(onion_mime_dict, "htm", "text/html", 0);
     onion_dict_add(onion_mime_dict, "js", "application/javascript", 0);
+    onion_dict_add(onion_mime_dict, "mjs", "application/javascript", 0);
     onion_dict_add(onion_mime_dict, "css", "text/css", 0);
     onion_dict_add(onion_mime_dict, "png", "image/png", 0);
     onion_dict_add(onion_mime_dict, "jpg", "image/jpeg", 0);
davidmoreno commented 5 years ago

Updated.

It's impossible to keep up with everything javascript.. I consider myself well informed and never heard before of mjs.

Also added CONTRIBUTORS.md file that was there waiting forever to be added.

Regards, David.

bstarynk commented 5 years ago

Thanks David