mediatype

package
v2.0.0-...-b64fcd6 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 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

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

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

Types

type ParseOptions

type ParseOptions struct {
	StripMediaTypeInvalidCharacters bool
}

ParseOptions controls the parsing of content-type and media-type strings.

Jump to

Keyboard shortcuts

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