libmime

package
v2.11.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2018 License: BSD-3-Clause Imports: 1 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Patch

func Patch(additional map[string]string)

Patch patches the mime types Go uses by calling mime.AddExtensionType on each from a builtin list in this package. Optionally, provide a non-nil additional map (ext->mimeType) to add additional mime types. The additional mime types are added after the builtin ones, and both builtin ones and the additional ones are added after the `mime` package loads from a few filesystem locations such as /etc/apache2/mime.types. In other words, the overriding precedence is:

filesystem -> builtin in this package -> optional additional parameter

where the ones on right side can override what's from ones on the left side.

Note that due to unpredictibility of what's on the device's file system, merely using this function may not be enough if you want to override a particular mime type (e.g. text/javascript). To do so you should check the determined mime type at a later time, e.g. before writing the HTTP response.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL