contenttype

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2019 License: BSD-3-Clause Imports: 3 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ApplicationMediaType    = "application"
	OctetStreamMediaSubtype = "octet-stream"
	TextMediaType           = "text"
	PlainMediaSubtype       = "plain"
	JsonMediaSubtype        = "json"
	XmlMediaSubtype         = "xml"
	ContentTypeHeaderKey    = "Content-Type"
)

Variables

View Source
var (
	ApplicationOctetStream = &ContentType{
		MediaType:    ApplicationMediaType,
		MediaSubtype: OctetStreamMediaSubtype,
	}
	TextPlain = &ContentType{
		MediaType:    TextMediaType,
		MediaSubtype: PlainMediaSubtype,
	}
	ApplicationJson = &ContentType{
		MediaType:    ApplicationMediaType,
		MediaSubtype: JsonMediaSubtype,
	}
	ApplicationXml = &ContentType{
		MediaType:    ApplicationMediaType,
		MediaSubtype: XmlMediaSubtype,
	}
)

Functions

This section is empty.

Types

type ContentType

type ContentType struct {
	MediaType    string
	MediaSubtype string
	// contains filtered or unexported fields
}

func New

func New(mediaType, mediaSubtype string) *ContentType

func Parse

func Parse(ct string) (*ContentType, error)

func (*ContentType) MarshalJSON

func (ct *ContentType) MarshalJSON() ([]byte, error)

func (*ContentType) String

func (ct *ContentType) String() string

type ContentTypeMap

type ContentTypeMap map[ContentType]interface{}

func (ContentTypeMap) Get

func (c ContentTypeMap) Get(key ContentType) (interface{}, bool)

Jump to

Keyboard shortcuts

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