mediatype

package
v0.0.0-...-22f70c5 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package mediatype provides types, constant and parsing functions for media types (MIME).

Index

Constants

View Source
const (
	// ApplicationJSON json mime type.
	ApplicationJSON string = "application/json"
	// ApplicationXML xml mime type.
	ApplicationXML string = "application/xml"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MediaType

type MediaType struct {
	MediaType string

	Type    string
	Subtype *string

	// Parameters are optional key-value pairs that follow the type/subtype in a MIME type.
	Parameters map[string]string
}

MediaType represents a media type (MIME).

A MIME type most commonly consists of just two parts: a type and a subtype, separated by a slash (/) — with no whitespace between:.

func Parse

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

Parse parses a media type string and returns a MediaType. If the string is not a valid media type, an error is returned.

Jump to

Keyboard shortcuts

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