Documentation ¶
Index ¶
Constants ¶
const ( AcceptKey = "Accept" AcceptEncodingKey = "Accept-Encoding" )
const ( ContentTypeKey = "Content-Type" ContentLength = "Content-Length" ContentEncodingKey = "Content-Encoding" ContentTypeAny ContentType = "*/*" TypeApplicationJSON ContentType = "application/json" TypeApplicationXML ContentType = "application/xml" TypeApplicationOctetStream ContentType = "application/octet-stream" TypeApplicationProtobuf ContentType = "application/protobuf" TypeApplicationMsgpack ContentType = "application/msgpack" TypeApplicationXSolomonSpack ContentType = "application/x-solomon-spack" EncodingAny ContentEncoding = "*" EncodingZSTD ContentEncoding = "zstd" EncodingLZ4 ContentEncoding = "lz4" EncodingGZIP ContentEncoding = "gzip" EncodingDeflate ContentEncoding = "deflate" TypeTextPlain ContentType = "text/plain" TypeTextHTML ContentType = "text/html" TypeTextCSV ContentType = "text/csv" TypeTextCmd ContentType = "text/cmd" TypeTextCSS ContentType = "text/css" TypeTextXML ContentType = "text/xml" TypeTextMarkdown ContentType = "text/markdown" TypeImageAny ContentType = "image/*" TypeImageJPEG ContentType = "image/jpeg" TypeImageGIF ContentType = "image/gif" TypeImagePNG ContentType = "image/png" TypeImageSVG ContentType = "image/svg+xml" TypeImageTIFF ContentType = "image/tiff" TypeImageWebP ContentType = "image/webp" TypeVideoMPEG ContentType = "video/mpeg" TypeVideoMP4 ContentType = "video/mp4" TypeVideoOgg ContentType = "video/ogg" TypeVideoWebM ContentType = "video/webm" )
const ( // XYaServiceTicket is http header that should be used for service ticket transfer. XYaServiceTicketKey = "X-Ya-Service-Ticket" // XYaUserTicket is http header that should be used for user ticket transfer. XYaUserTicketKey = "X-Ya-User-Ticket" )
const ( WarningKey = "Warning" WarningResponseIsStale = 110 // RFC 7234, 5.5.1 WarningRevalidationFailed = 111 // RFC 7234, 5.5.2 WarningDisconnectedOperation = 112 // RFC 7234, 5.5.3 WarningHeuristicExpiration = 113 // RFC 7234, 5.5.4 WarningMiscellaneousWarning = 199 // RFC 7234, 5.5.5 WarningTransformationApplied = 214 // RFC 7234, 5.5.6 WarningMiscellaneousPersistentWarning = 299 // RFC 7234, 5.5.7 )
const (
CookieKey = "Cookie"
)
const (
UserAgentKey = "User-Agent"
)
Variables ¶
This section is empty.
Functions ¶
func AddWarning ¶
AddWarning adds Warning to http.Header with proper formatting see: https://tools.ietf.org/html/rfc7234#section-5.5
func WarningText ¶
WarningText returns a text for the warning header code. It returns the empty string if the code is unknown.
Types ¶
type AcceptableEncoding ¶
type AcceptableEncoding struct { Encoding ContentEncoding Weight float32 // contains filtered or unexported fields }
type AcceptableEncodings ¶
type AcceptableEncodings []AcceptableEncoding
func ParseAcceptEncoding ¶
func ParseAcceptEncoding(headerValue string) (AcceptableEncodings, error)
ParseAcceptEncoding parses Accept-Encoding HTTP header. It will sort acceptable encodings by weight and position. See: https://tools.ietf.org/html/rfc2616#section-14.3
func (AcceptableEncodings) IsAcceptable ¶
func (as AcceptableEncodings) IsAcceptable(encoding ContentEncoding) bool
func (AcceptableEncodings) String ¶
func (as AcceptableEncodings) String() string
type AcceptableType ¶
type AcceptableType struct { Type ContentType Weight float32 Extension map[string]string // contains filtered or unexported fields }
type AcceptableTypes ¶
type AcceptableTypes []AcceptableType
func ParseAccept ¶
func ParseAccept(headerValue string) (AcceptableTypes, error)
ParseAccept parses Accept HTTP header. It will sort acceptable types by weight, specificity and position. See: https://tools.ietf.org/html/rfc2616#section-14.1
func (AcceptableTypes) IsAcceptable ¶
func (as AcceptableTypes) IsAcceptable(contentType ContentType) bool
func (AcceptableTypes) String ¶
func (as AcceptableTypes) String() string
type ContentEncoding ¶
type ContentEncoding string
func (ContentEncoding) String ¶
func (ce ContentEncoding) String() string
String implements stringer interface
type ContentType ¶
type ContentType string
func (ContentType) String ¶
func (ct ContentType) String() string
String implements stringer interface
type WarningHeader ¶
func ParseWarnings ¶
func ParseWarnings(h http.Header) ([]WarningHeader, error)
ParseWarnings reads and parses Warning headers from http.Header