Skip to content

Commit

Permalink
add GetTypeByMIME (fix for h2non#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin committed Feb 21, 2019
1 parent 2248f2e commit 38e51a3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions filetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,12 @@ func IsMIMESupported(mime string) bool {
func GetType(ext string) types.Type {
return types.Get(ext)
}

func GetTypeByMIME(mime string) types.Type {
for _, kind := range types.Types {
if kind.MIME.Value == mime {
return kind
}
}
return types.Unknown
}

0 comments on commit 38e51a3

Please sign in to comment.