Ensures basic mime types are installed in package mime
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
generator
.gitignore
.travis.yml
Makefile
README.md
data.go
mime.go

README.md

httpmime

Ensures basic mime types are installed in golang's mime package

If you use the golang mime package you may be using an incomplete set of data.

By default, golang comes with a very small internal table mapping extentions (e.g. .html) to mime types (.e.g text/html).

On Windows this table is supplemented via the registry. On other systems, this table is supplemented by searching through the /etc directory looking for a mime type file.

The problem is many unix-like systems don't have this file installed. In particular, alpine linux does not have any of these files installed by default.

This package will check to see if the mime package has loaded data, and if not, will add all basic mime types so it works correctly. The mime data comes the same data set that Apache's httpd webserver uses, and is in the public domain.