mediatype

package
v0.0.0-...-0f8ae5d Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package mediatype implements the IANA Media Type standard.

Although a partial implementation exists in the standard library under pkg/mime, it misses functionality, such as representation of suffices, and an explicit container format for media types. This package wraps the library, providing those functions.

For Further information on media types see https://www.iana.org/assignments/media-types/media-types.xhtml

Index

Constants

View Source
const (
	HeaderContentType = "Content-Type"
)

Variables

This section is empty.

Functions

func SetContentTypeHeader

func SetContentTypeHeader(m *MediaType, w http.ResponseWriter)

Types

type MediaType

type MediaType struct {
	Parameters map[string]string
	Type       string
	Subtype    string
	Suffix     string
}

See: https://en.wikipedia.org/wiki/Media_type

func MustParse

func MustParse(s string) *MediaType

func Parse

func Parse(s string) (*MediaType, error)

func (*MediaType) Copy

func (m *MediaType) Copy() *MediaType

func (*MediaType) GetParam

func (m *MediaType) GetParam(key string) (string, bool)

func (*MediaType) Identifier

func (m *MediaType) Identifier() string

func (*MediaType) SetParam

func (m *MediaType) SetParam(key string, val string) bool

func (*MediaType) String

func (m *MediaType) String() string

func (*MediaType) TypeEquals

func (m *MediaType) TypeEquals(other *MediaType) bool

Jump to

Keyboard shortcuts

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