forked from elastic/package-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mime_types.go
27 lines (22 loc) · 884 Bytes
/
mime_types.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
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.
package main
import (
"mime"
"github.com/elastic/package-registry/util"
)
// init method defines MIME types important for the package content. Definitions ensure that the same Content-Type
// will be returned if the /etc/mime.types is empty or tiny.
func init() {
mustAddMimeExtensionType(".zip", "application/zip")
mustAddMimeExtensionType(".ico", "image/x-icon")
mustAddMimeExtensionType(".md", "text/markdown; charset=utf-8")
mustAddMimeExtensionType(".yml", "text/yaml; charset=UTF-8")
}
func mustAddMimeExtensionType(ext, typ string) {
err := mime.AddExtensionType(ext, typ)
if err != nil {
util.Logger().Fatal(err.Error())
}
}