Documentation
¶
Overview ¶
Package httpcodec owns the built-in HTTP runtime's role-specific codec selection. Media labels, negotiation and decoder support are distinct inputs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Kind ¶
type Kind uint8
Kind identifies a built-in codec or a selector's explicit failure.
const ( // Invalid means an explicit response Content-Type failed MIME parsing. Invalid Kind = iota // Unsupported means the request decoder does not support this media type. Unsupported // JSON selects the framework JSON codec. JSON // XML selects encoding/xml. XML // GOB selects encoding/gob. GOB // Text selects the framework text codec. Text )
type Selection ¶
type Selection struct {
// Kind is the selected codec.
Kind Kind
// Media is normalized when parsing succeeds, otherwise the original input.
Media string
}
Selection retains the media spelling used by runtime headers and errors.
func RequestContentType ¶
RequestContentType selects the server request decoder. Only exact built-in media types are accepted; a missing header defaults to JSON.
func ResponseAccept ¶
ResponseAccept selects the server response encoder without a Content-Type override. Only exact built-in media are negotiated; all others default JSON.
func ResponseContentType ¶
ResponseContentType selects an explicitly configured server response encoder. Invalid MIME returns Invalid; valid unknown types retain the JSON fallback.
func ResponseDecode ¶
ResponseDecode selects the client response decoder. Parse failures retain the raw spelling for suffix dispatch. Missing or unmatched media default to JSON.