-
Notifications
You must be signed in to change notification settings - Fork 0
/
mime.go
44 lines (39 loc) · 990 Bytes
/
mime.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package ghttp
const JSON = "application/json"
const XML = "application/xml"
const XHTML = "application/html+xml"
const FORM = "application/x-www-form-urlencoded"
const UPLOAD = "multipart/form-data"
const PLAIN = "text/plain"
const JS = "text/javascript"
const HTML = "text/html"
const YAML = "application/x-yaml"
const CSV = "text/csv"
var Mimes = map[string]string{
"json": JSON,
"xml": XML,
"form": FORM,
"plain": PLAIN,
"text": PLAIN,
"upload": UPLOAD,
"html": HTML,
"xhtml": XHTML,
"js": JS,
"javascript": JS,
"yaml": YAML,
"csv": CSV,
}
// GetFullMime Get the full Mime Type name from a "short name".
func GetFullMime(shortName string) string {
if _, ok := Mimes[shortName]; ok {
shortName = Mimes[shortName]
}
return shortName
}
// SupportsMimeType Determine whether it supports
func SupportsMimeType(shortName string) bool {
if _, ok := Mimes[shortName]; ok {
return true
}
return false
}