Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcceptableTypes ¶
type AcceptableTypes []*MediaType
func ParseAccept ¶
func ParseAccept(values []string) (AcceptableTypes, error)
ParseAccept parses a set of Accept headers and scores them per the rules in RFC7231, returning a slice of headers in descending order of priority. If the Accept header occurs multiple times in the request the result of all headers will be combined and scored together as if they were all in one header line.
func (AcceptableTypes) FindMatch ¶
func (a AcceptableTypes) FindMatch(values AcceptableTypes) (match *MediaType, matcher *MediaType)
FindMatch returns the MediaType in the set that has the best match for the passed media types as well as the media type that determined the match. According to the rules of RFC7231, the most specific match wins in order of weight. This function assumes that both values are sorted.
func (AcceptableTypes) Len ¶
func (a AcceptableTypes) Len() int
func (AcceptableTypes) Less ¶
func (a AcceptableTypes) Less(i, j int) bool
func (AcceptableTypes) Sorted ¶
func (a AcceptableTypes) Sorted() AcceptableTypes
func (AcceptableTypes) Swap ¶
func (a AcceptableTypes) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.