httpctype

package
v0.6.15 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 1 Imported by: 4

Documentation

Overview

Package httpctype list some common http content-type

Index

Constants

View Source
const (
	CSS  = "text/css; charset=utf-8"
	HTML = "text/html; charset=utf-8"

	Text  = "text/plain; charset=utf-8" // equals Plain
	Plain = Text

	XML2 = "text/xml; charset=utf-8"
	XML  = "application/xml; charset=utf-8"

	YAML = "application/x-yaml; charset=utf-8"
	YML  = YAML

	JSON  = "application/json; charset=utf-8"
	JSONP = "application/javascript; charset=utf-8" // equals to JS

	JS  = "application/javascript; charset=utf-8"
	JS2 = "text/javascript; charset=utf-8"

	Form = "application/x-www-form-urlencoded; charset=utf-8"
	// FormData for upload file
	FormData = "multipart/form-data"
	DataForm = FormData

	// Binary represents content type application/octet-stream
	Binary   = "application/octet-stream"
	PROTOBUF = "application/x-protobuf"
	MSGPACK  = "application/x-msgpack; charset=utf-8"
	MSGPACK2 = "application/msgpack; charset=utf-8"
)

there are some HTTP Content-Type with charset of the most common data formats.

View Source
const (
	KindForm     = "form"
	KindFormData = "dataForm"
	KindJSON     = "json"
	KindXML      = "xml"
	KindYAML     = "yaml"
)

there commonly base type category list

View Source
const (
	MIMEHTML  = "text/html"
	MIMEHtml  = MIMEHTML
	MIMEText  = "text/plain" // equals MIMEPlain
	MIMEPlain = MIMEText

	MIMEJSON = "application/json"

	MIMEYAML = "application/x-yaml"
	MIMEYaml = MIMEYAML
	MIMEXML  = "application/xml"
	MIMEXML2 = "text/xml"

	MIMEForm          = "application/x-www-form-urlencoded"
	MIMEPOSTForm      = MIMEForm
	MIMEDataForm      = "multipart/form-data"
	MIMEMultiDataForm = MIMEDataForm

	MIMEPROTOBUF = "application/x-protobuf"
	MIMEMSGPACK  = "application/x-msgpack"
	MIMEMSGPACK2 = "application/msgpack"
)

there are some Content-Type MIME of the most common data formats.

View Source
const Key = "Content-Type"

Key is the header key of Content-Type

Variables

This section is empty.

Functions

func ToKind added in v0.6.8

func ToKind(cType, defaultType string) string

ToKind name match

func ToKindWithFunc added in v0.6.13

func ToKindWithFunc(cType string, fbFunc func(cType string) string) string

ToKindWithFunc match base kind name by content-type, with a fallback func

Types

This section is empty.

Jump to

Keyboard shortcuts

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