Add CT_TEXT_JAVASCRIPT (#1654)

This commit is contained in:
Umar Sharief 2023-07-01 04:43:39 +01:00 committed by GitHub
parent 61073b4f74
commit 74bb47c690
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -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,

View File

@ -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";