contenttype

package
v2.0.0-beta.14 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchAcceptStrict

func MatchAcceptStrict(requestHeaders http.Header, offers []string) string

MatchAcceptStrict returns the best matching offer explicitly listed in the request's Accept header, ignoring wildcard media ranges ("*/*" and "type/*").

Only exact media-type matches are considered. Entries with q=0 are ignored. If multiple offers match, the one with the highest q-value is selected. If q-values tie, the offer that appears earlier in the offers slice wins.

MatchAcceptStrict returns "" if the Accept header is not present or no explicit match is found.

func Negotiate

func Negotiate(requestHeaders http.Header, offers []string, defaultOffer string) string

Negotiate returns the best offered content type for the request's Accept header. If two offers match with equal weight, then the more specific offer is preferred. For example, text/* trumps */*. If two offers match with equal weight and specificity, then the offer earlier in the list is preferred. If no offers match, then defaultOffer is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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