19 lines
317 B
Go
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
|
|
}
|