Documentation
¶
Index ¶
- Constants
- func Compress(writer io.Writer, encoding string) (io.Writer, error)
- func Decode(reader io.Reader, header textproto.MIMEHeader) (types.Value, error)
- func Decompress(reader io.Reader, encoding string) (io.Reader, error)
- func DetectTypesFromBytes(value []byte) []string
- func DetectTypesFromValue(value types.Value) []string
- func Encode(writer io.Writer, value types.Value, header textproto.MIMEHeader) error
- func IsCompatible(x, y string) bool
- func IsResponseHeader(header string) bool
- func Negotiate(value string, offers []string) string
Constants ¶
View Source
const ( EncodingGzip = "gzip" EncodingDeflate = "deflate" EncodingBr = "br" EncodingIdentity = "identity" )
View Source
const ( HeaderAccept = "Accept" HeaderAcceptCharset = "Accept-Charset" HeaderAcceptEncoding = "Accept-Encoding" HeaderAcceptLanguage = "Accept-Language" HeaderAllow = "Allow" HeaderAuthorization = "Authorization" HeaderContentDisposition = "Content-Disposition" HeaderContentEncoding = "Content-Encoding" HeaderContentLength = "Content-Length" HeaderContentType = "Content-Type" HeaderCookie = "Cookie" HeaderSetCookie = "Set-Cookie" HeaderIfModifiedSince = "If-Modified-Since" HeaderLastModified = "Last-Modified" HeaderLocation = "Location" HeaderRetryAfter = "Retry-After" HeaderUpgrade = "Upgrade" HeaderUpgradeInsecureRequests = "Upgrade-Insecure-Requests" HeaderVary = "Vary" HeaderWWWAuthenticate = "WWW-Authenticate" HeaderForwarded = "Forwarded" HeaderXForwardedFor = "X-Forwarded-For" HeaderXForwardedHost = "X-Forwarded-Host" HeaderXForwardedProto = "X-Forwarded-Proto" HeaderXForwardedProtocol = "X-Forwarded-Protocol" HeaderXForwardedSsl = "X-Forwarded-Ssl" HeaderXUrlScheme = "X-Url-Scheme" HeaderXHTTPMethodOverride = "X-HTTP-Method-Override" HeaderXRealIP = "X-Real-Ip" HeaderXRequestID = "X-Request-Id" HeaderXCorrelationID = "X-Correlation-Id" HeaderXRequestedWith = "X-Requested-With" HeaderServer = "Server" HeaderOrigin = "Origin" HeaderCacheControl = "Cache-Control" HeaderConnection = "Connection" HeaderDate = "Date" HeaderDeviceMemory = "Device-Memory" HeaderDNT = "DNT" HeaderDownlink = "Downlink" HeaderDPR = "DPR" HeaderEarlyData = "Early-Data" HeaderECT = "ECT" HeaderExpect = "Expect" HeaderExpectCT = "Expect-CT" HeaderFrom = "From" HeaderHost = "Host" HeaderIfMatch = "If-Match" HeaderIfNoneMatch = "If-None-Match" HeaderIfRange = "If-Range" HeaderIfUnmodifiedSince = "If-Unmodified-Since" HeaderKeepAlive = "Keep-Alive" HeaderMaxForwards = "Max-Forwards" HeaderProxyAuthorization = "Proxy-Authorization" HeaderRange = "Range" HeaderReferer = "Referer" HeaderRTT = "RTT" HeaderSaveData = "Save-Data" HeaderTE = "TE" HeaderTk = "Tk" HeaderTrailer = "Trailer" HeaderTransferEncoding = "Transfer-Encoding" HeaderUserAgent = "User-Agent" HeaderVia = "Via" HeaderViewportWidth = "Viewport-Width" HeaderWantDigest = "Want-Digest" HeaderWarning = "Warning" HeaderWidth = "Width" HeaderAccessControlRequestMethod = "Access-Control-Request-Method" HeaderAccessControlRequestHeaders = "Access-Control-Request-Headers" HeaderAccessControlAllowOrigin = "Access-Control-Allow-Origin" HeaderAccessControlAllowMethods = "Access-Control-Allow-Methods" HeaderAccessControlAllowHeaders = "Access-Control-Allow-Headers" HeaderAccessControlAllowCredentials = "Access-Control-Allow-Credentials" HeaderAccessControlExposeHeaders = "Access-Control-Expose-Headers" HeaderAccessControlMaxAge = "Access-Control-Max-Age" HeaderStrictTransportSecurity = "Strict-Transport-Security" HeaderXContentTypeOptions = "X-Content-Type-Options" HeaderXXSSProtection = "X-XSS-Protection" HeaderXFrameOptions = "X-Frame-Options" HeaderContentSecurityPolicy = "Content-Security-Policy" HeaderContentSecurityPolicyReportOnly = "Content-Security-Policy-Report-Only" HeaderXCSRFToken = "X-CSRF-Token" HeaderReferrerPolicy = "Referrer-Policy" )
View Source
const ( ApplicationJSON = "application/json" ApplicationJSONCharsetUTF8 = ApplicationJSON + "; " + charsetUTF8 ApplicationJavaScript = "application/javascript" ApplicationJavaScriptCharsetUTF8 = ApplicationJavaScript + "; " + charsetUTF8 ApplicationXML = "application/xml" ApplicationXMLCharsetUTF8 = ApplicationXML + "; " + charsetUTF8 ApplicationOctetStream = "application/octet-stream" TextXML = "text/xml" TextXMLCharsetUTF8 = TextXML + "; " + charsetUTF8 ApplicationFormURLEncoded = "application/x-www-form-urlencoded" ApplicationProtobuf = "application/protobuf" ApplicationMsgpack = "application/msgpack" TextHTML = "text/html" TextHTMLCharsetUTF8 = TextHTML + "; " + charsetUTF8 TextPlain = "text/plain" TextPlainCharsetUTF8 = TextPlain + "; " + charsetUTF8 MultipartFormData = "multipart/form-data" )
Variables ¶
This section is empty.
Functions ¶
func Compress ¶
Compress compresses input data using the specified encoding, returns original if unsupported.
func Decompress ¶
Decompress decompresses input data using the specified encoding, returns original if unsupported.
func DetectTypesFromBytes ¶ added in v0.12.0
DetectTypesFromBytes determines the potential content types of the given byte slice.
func DetectTypesFromValue ¶ added in v0.12.0
DetectTypesFromValue determines the content types based on the type of types passed.
func IsCompatible ¶
IsCompatible checks if two media types are compatible.
func IsResponseHeader ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.