const ( JSON = MimeType("application/json") BSON = MimeType("application/bson") YAML = MimeType("application/yaml") TEXT = MimeType("text/plain") // UNKNOWN is used when the incoming string is blank UNKNOWN = MimeType("") )
MimeType is used to enumerate the default representation for content encoding types. Non default MimeTypes can be used by wrapping a custom string:
MimeType("text/csv")
type MimeType string
func FromHeader(headers headerFetcher) MimeType
Extract content type from a message / request header.
func FromString(incoming string) MimeType
Convert MimeType from a string. Ignores case. If the MimeType is a default type, multiple formats are respected. For instance, all of the following will yield "mimetype.JSON":
• "application/json"“
• "application/JSON"
• "application/x-json"
• "json"
• "x-json"