Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 8b92144

Browse files
committed
Add source files mimetypes
1 parent d3f474c commit 8b92144

File tree

1 file changed

+47
-8
lines changed

1 file changed

+47
-8
lines changed

src/ServiceStack.Text/HttpUtils.cs

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,12 +1560,17 @@ public static string GetMimeType(string fileNameOrExt)
15601560
switch (fileExt)
15611561
{
15621562
case "jpeg":
1563+
return "image/jpeg";
15631564
case "gif":
1565+
return "image/gif";
15641566
case "png":
1567+
return "image/png";
15651568
case "tiff":
1569+
return "image/tiff";
15661570
case "bmp":
1571+
return "image/bmp";
15671572
case "webp":
1568-
return "image/" + fileExt;
1573+
return "image/webp";
15691574

15701575
case "jpg":
15711576
return "image/jpeg";
@@ -1586,10 +1591,8 @@ public static string GetMimeType(string fileNameOrExt)
15861591

15871592
case "js":
15881593
return "text/javascript";
1589-
15901594
case "ts":
1591-
return "text/x.typescript";
1592-
1595+
return "text/typescript";
15931596
case "jsx":
15941597
return "text/jsx";
15951598

@@ -1598,12 +1601,49 @@ public static string GetMimeType(string fileNameOrExt)
15981601
case "css":
15991602
return Css;
16001603

1601-
case "sgml":
1602-
return "text/" + fileExt;
1604+
case "cs":
1605+
return "text/x-csharp";
1606+
case "fs":
1607+
return "text/x-fsharp";
1608+
case "vb":
1609+
return "text/x-vb";
1610+
case "dart":
1611+
return "application/dart";
1612+
case "go":
1613+
return "text/x-go";
1614+
case "kt":
1615+
case "kts":
1616+
return "text/x-kotlin";
1617+
case "java":
1618+
return "text/x-java";
1619+
case "py":
1620+
return "text/x-python";
1621+
case "groovy":
1622+
case "gradle":
1623+
return "text/x-groovy";
1624+
1625+
case "yml":
1626+
case "yaml":
1627+
return YamlText;
1628+
1629+
case "sh":
1630+
return "text/x-sh";
1631+
case "bat":
1632+
case "cmd":
1633+
return "application/bat";
1634+
1635+
case "xml":
1636+
case "csproj":
1637+
case "fsproj":
1638+
case "vbproj":
1639+
return "text/xml";
16031640

16041641
case "txt":
16051642
return "text/plain";
16061643

1644+
case "sgml":
1645+
return "text/sgml";
1646+
16071647
case "mp3":
16081648
return "audio/mpeg3";
16091649

@@ -1722,7 +1762,7 @@ public static string GetMimeType(string fileNameOrExt)
17221762

17231763
case "jar":
17241764
return Jar;
1725-
1765+
17261766
case "aaf":
17271767
case "aca":
17281768
case "asd":
@@ -1740,7 +1780,6 @@ public static string GetMimeType(string fileNameOrExt)
17401780
case "fla":
17411781
case "ics":
17421782
case "inf":
1743-
case "java":
17441783
case "mix":
17451784
case "msi":
17461785
case "mso":

0 commit comments

Comments
 (0)