mediatype

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(ctype string) (mtype string, params map[string]string, invalidParams []string, err error)

Parse is a more tolerant implementation of Go's mime.ParseMediaType function.

Tolerances accounted for:

  • Missing ';' between content-type and media parameters
  • Repeating media parameters
  • Unquoted values in media parameters containing 'tspecials' characters
  • Newline characters

func ParseWithOptions added in v1.2.0

func ParseWithOptions(ctype string, options MediaTypeParseOptions) (mtype string, params map[string]string, invalidParams []string, err error)

ParseWithOptions parses media-type with additional options controlling the parsing behavior.

Types

type MediaTypeParseOptions added in v1.2.0

type MediaTypeParseOptions struct {
	StripMediaTypeInvalidCharacters bool
}

Jump to

Keyboard shortcuts

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