[server] Add other wellknown mime types.
This commit is contained in:
parent
0d1cd46681
commit
fc0dde974b
2 changed files with 91 additions and 6 deletions
|
@ -17,12 +17,56 @@ const MimeTypeXml = "application/xml; charset=utf-8"
|
||||||
const MimeTypeXslt = "application/xslt+xml; charset=utf-8"
|
const MimeTypeXslt = "application/xslt+xml; charset=utf-8"
|
||||||
const MimeTypeXhtml = "application/xhtml+xml; charset=utf-8"
|
const MimeTypeXhtml = "application/xhtml+xml; charset=utf-8"
|
||||||
|
|
||||||
|
// NOTE: Based on: https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types
|
||||||
|
const MimeTypeSvg = "image/svg+xml; charset=utf-8"
|
||||||
|
const MimeTypePng = "image/png"
|
||||||
|
const MimeTypeJpeg = "image/jpeg"
|
||||||
|
const MimeTypeWebp = "image/webp"
|
||||||
|
const MimeTypeGif = "image/gif"
|
||||||
|
const MimeTypeIco = "image/x-icon"
|
||||||
|
const MimeTypeBmp = "image/bmp"
|
||||||
|
const MimeTypeTiff = "image/tiff"
|
||||||
|
const MimeTypeApng = "image/apng"
|
||||||
|
|
||||||
|
const MimeTypeAvif = "image/avif"
|
||||||
|
const MimeTypeAvifSequence = "image/avif-sequence"
|
||||||
|
const MimeTypeHeic = "image/heic"
|
||||||
|
const MimeTypeHeicSequence = "image/heic-sequence"
|
||||||
|
const MimeTypeHeif = "image/heif"
|
||||||
|
const MimeTypeHeifSequence = "image/heif-sequence"
|
||||||
|
|
||||||
|
const MimeTypeOtf = "font/otf"
|
||||||
|
const MimeTypeTtf = "font/ttf"
|
||||||
|
const MimeTypeWoff = "font/woff"
|
||||||
|
const MimeTypeWoff2 = "font/woff2"
|
||||||
|
|
||||||
|
const MimeTypeWav = "audio/wav"
|
||||||
|
const MimeTypeMidi = "audio/midi"
|
||||||
|
const MimeTypeAac = "audio/aac"
|
||||||
|
const MimeTypeOpus = "audio/opus"
|
||||||
|
const MimeTypeAudioMpeg = "audio/mpeg"
|
||||||
|
const MimeTypeAudioWebm = "audio/webm"
|
||||||
|
const MimeTypeAudioOgg = "audio/ogg"
|
||||||
|
|
||||||
|
const MimeTypeAvi = "video/x-msvideo"
|
||||||
|
const MimeTypeMp4 = "video/mp4"
|
||||||
|
const MimeTypeVideoMpeg = "video/mpeg"
|
||||||
|
const MimeTypeVideoWebm = "video/webm"
|
||||||
|
const MimeTypeVideoOgg = "video/ogg"
|
||||||
|
|
||||||
|
const MimeTypePdf = "application/pdf"
|
||||||
|
const MimeTypePs = "application/postscript"
|
||||||
|
const MimeTypeIcs = "text/calendar"
|
||||||
|
|
||||||
|
const MimeTypeZip = "application/zip"
|
||||||
|
|
||||||
const MimeTypeRaw = "application/octet-stream"
|
const MimeTypeRaw = "application/octet-stream"
|
||||||
|
|
||||||
|
|
||||||
var MimeTypesByExtension = map[string]string {
|
var MimeTypesByExtension = map[string]string {
|
||||||
|
|
||||||
|
// NOTE: Based on: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
|
||||||
|
|
||||||
"txt" : MimeTypeText,
|
"txt" : MimeTypeText,
|
||||||
"csv" : MimeTypeCsv,
|
"csv" : MimeTypeCsv,
|
||||||
"tsv" : MimeTypeCsv,
|
"tsv" : MimeTypeCsv,
|
||||||
|
@ -30,17 +74,58 @@ var MimeTypesByExtension = map[string]string {
|
||||||
"html" : MimeTypeHtml,
|
"html" : MimeTypeHtml,
|
||||||
"css" : MimeTypeCss,
|
"css" : MimeTypeCss,
|
||||||
"js" : MimeTypeJs,
|
"js" : MimeTypeJs,
|
||||||
|
"mjs" : MimeTypeJs,
|
||||||
"json" : MimeTypeJson,
|
"json" : MimeTypeJson,
|
||||||
|
|
||||||
"xml" : MimeTypeXml,
|
"xml" : MimeTypeXml,
|
||||||
"xslt" : MimeTypeXml,
|
"xslt" : MimeTypeXml,
|
||||||
"xhtml" : MimeTypeXhtml,
|
"xhtml" : MimeTypeXhtml,
|
||||||
|
|
||||||
"svg" : "image/svg+xml",
|
"svg" : MimeTypeSvg,
|
||||||
"png" : "image/png",
|
"png" : MimeTypePng,
|
||||||
"gif" : "image/gif",
|
"jpeg" : MimeTypeJpeg,
|
||||||
"jpeg" : "image/jpeg",
|
"jpg" : MimeTypeJpeg,
|
||||||
"jpg" : "image/jpeg",
|
"webp" : MimeTypeWebp,
|
||||||
|
"gif" : MimeTypeGif,
|
||||||
|
"ico" : MimeTypeIco,
|
||||||
|
"cur" : MimeTypeIco,
|
||||||
|
"bmp" : MimeTypeBmp,
|
||||||
|
"tiff" : MimeTypeTiff,
|
||||||
|
"tif" : MimeTypeTiff,
|
||||||
|
"apng" : MimeTypeApng,
|
||||||
|
|
||||||
|
"avif" : MimeTypeAvif,
|
||||||
|
"avifs" : MimeTypeAvifSequence,
|
||||||
|
"heic" : MimeTypeHeic,
|
||||||
|
"heics" : MimeTypeHeicSequence,
|
||||||
|
"heif" : MimeTypeHeif,
|
||||||
|
"heifs" : MimeTypeHeifSequence,
|
||||||
|
|
||||||
|
"otf" : MimeTypeOtf,
|
||||||
|
"ttf" : MimeTypeTtf,
|
||||||
|
"woff" : MimeTypeWoff,
|
||||||
|
"woff2" : MimeTypeWoff2,
|
||||||
|
|
||||||
|
"wav" : MimeTypeWav,
|
||||||
|
"mid" : MimeTypeMidi,
|
||||||
|
"midi" : MimeTypeMidi,
|
||||||
|
"aac" : MimeTypeAac,
|
||||||
|
"opus" : MimeTypeOpus,
|
||||||
|
"mp3" : MimeTypeAudioMpeg,
|
||||||
|
"weba" : MimeTypeAudioWebm,
|
||||||
|
"oga" : MimeTypeAudioOgg,
|
||||||
|
|
||||||
|
"avi" : MimeTypeAvi,
|
||||||
|
"mp4" : MimeTypeMp4,
|
||||||
|
"mpeg" : MimeTypeVideoMpeg,
|
||||||
|
"webm" : MimeTypeVideoWebm,
|
||||||
|
"ogv" : MimeTypeVideoOgg,
|
||||||
|
|
||||||
|
"pdf" : MimeTypePdf,
|
||||||
|
"ps" : MimeTypePs,
|
||||||
|
"ics" : MimeTypeIcs,
|
||||||
|
|
||||||
|
"zip" : MimeTypeZip,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ var DummyContentEncoding = "identity"
|
||||||
var DummyData = []byte ("hello world!\n")
|
var DummyData = []byte ("hello world!\n")
|
||||||
|
|
||||||
|
|
||||||
var FaviconContentType = "image/vnd.microsoft.icon"
|
var FaviconContentType = MimeTypeIco
|
||||||
var FaviconContentEncoding = "identity"
|
var FaviconContentEncoding = "identity"
|
||||||
|
|
||||||
//go:embed files/favicon.ico
|
//go:embed files/favicon.ico
|
||||||
|
|
Loading…
Reference in a new issue