diff --git a/lib/inc/drogon/HttpTypes.h b/lib/inc/drogon/HttpTypes.h index 58fb8d8b..72a8d42c 100644 --- a/lib/inc/drogon/HttpTypes.h +++ b/lib/inc/drogon/HttpTypes.h @@ -102,7 +102,8 @@ enum ContentType CT_TEXT_PLAIN, CT_TEXT_HTML, CT_APPLICATION_X_FORM, - CT_APPLICATION_X_JAVASCRIPT, + CT_APPLICATION_X_JAVASCRIPT [[deprecated("use CT_TEXT_JAVASCRIPT")]], + CT_TEXT_JAVASCRIPT, CT_TEXT_CSS, CT_TEXT_XML, CT_APPLICATION_XML, diff --git a/lib/src/HttpUtils.cc b/lib/src/HttpUtils.cc index 7f5d675c..22c02d10 100644 --- a/lib/src/HttpUtils.cc +++ b/lib/src/HttpUtils.cc @@ -393,7 +393,7 @@ ContentType getContentType(const std::string &fileName) case 2: { if (extName == "js") - return CT_APPLICATION_X_JAVASCRIPT; + return CT_TEXT_JAVASCRIPT; return CT_APPLICATION_OCTET_STREAM; } case 3: @@ -569,6 +569,11 @@ const string_view &contentTypeToMime(ContentType contenttype) static string_view sv = "application/x-javascript; charset=utf-8"; return sv; } + case CT_TEXT_JAVASCRIPT: + { + static string_view sv = "text/javascript; charset=utf-8"; + return sv; + } case CT_TEXT_CSS: { static string_view sv = "text/css; charset=utf-8";