content

package
v1.343.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (

	// TypeKey for HTTP headers.
	TypeKey = "Content-Type"
)

Variables

This section is empty.

Functions

func Decode added in v1.326.0

func Decode(ctx context.Context, v any) error

Decode to v, unless an error occurs.

Types

type Content added in v1.287.0

type Content struct {
	// contains filtered or unexported fields
}

Content creates types from media types.

func NewContent added in v1.287.0

func NewContent(enc *encoding.Map) *Content

NewContent with an encoding.

func (*Content) NewFromMedia added in v1.287.0

func (c *Content) NewFromMedia(mediaType string) *Media

NewFromMedia for content.

func (*Content) NewFromRequest added in v1.287.0

func (c *Content) NewFromRequest(req *http.Request) *Media

NewFromRequest for content.

func (*Content) NewHandler added in v1.287.0

func (c *Content) NewHandler(prefix string, handler Handler) func(res http.ResponseWriter, req *http.Request)

NewHandler for content.

type Handler added in v1.286.0

type Handler func(ctx context.Context) (any, error)

Handler for content.

type Media added in v1.340.0

type Media struct {
	// The encoder for the media type.
	Encoder encoding.Encoder

	// The type, e.g. text.
	Type string

	// The sub type, e.g. plain.
	Subtype string
}

Media for content. https://en.wikipedia.org/wiki/Media_type

func (*Media) IsText added in v1.340.0

func (t *Media) IsText() bool

IsText for type.

Jump to

Keyboard shortcuts

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