Files
serveg/internal/http/mime.go
T
2026-11-02 21:47:34 +01:00

19 lines
317 B
Go

package http
import (
"mime"
"path"
)
const MimeDefault = "application/octet-stream"
const TextPlain = "text/plain; charset=utf-8"
const TextHtml = "text/html; charset=utf-8"
func GetMimeType(filePath string) string {
t := mime.TypeByExtension(path.Ext(filePath))
if t == "" {
t = MimeDefault
}
return t
}