Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data CompressionType = CTGZip
- type EncodingType = Maybe CompressionType
- identityEncoding :: EncodingType
- compressionTypeToTxt :: CompressionType -> Text
- contentEncodingHeader :: CompressionType -> Header
- compressResponse :: RequestHeaders -> ByteString -> (ByteString, EncodingType)
- compressFast :: CompressionType -> ByteString -> ByteString
- getAcceptedEncodings :: RequestHeaders -> Set EncodingType
Documentation
data CompressionType Source #
Compressed encodings which hasura supports
Instances
Show CompressionType Source # | |
Defined in Hasura.Server.Compression showsPrec :: Int -> CompressionType -> ShowS # show :: CompressionType -> String # showList :: [CompressionType] -> ShowS # | |
Eq CompressionType Source # | |
Defined in Hasura.Server.Compression (==) :: CompressionType -> CompressionType -> Bool # (/=) :: CompressionType -> CompressionType -> Bool # | |
Ord CompressionType Source # | |
Defined in Hasura.Server.Compression compare :: CompressionType -> CompressionType -> Ordering # (<) :: CompressionType -> CompressionType -> Bool # (<=) :: CompressionType -> CompressionType -> Bool # (>) :: CompressionType -> CompressionType -> Bool # (>=) :: CompressionType -> CompressionType -> Bool # max :: CompressionType -> CompressionType -> CompressionType # min :: CompressionType -> CompressionType -> CompressionType # |
type EncodingType = Maybe CompressionType Source #
Accept-Encoding directives (from client) which hasura supports. Nothing
indicates identity (no compression)
contentEncodingHeader :: CompressionType -> Header Source #
A map from Accept-Encoding directives to corresponding Content-Encoding
headers (from server). NOTE: identity
is not a valid directive for this
header.
:: RequestHeaders | |
-> ByteString | |
-> (ByteString, EncodingType) | The response body (possibly compressed), and the encoding chosen |
Maybe compress the response body, based on the client's Accept-Encoding and our own judgement.
compressFast :: CompressionType -> ByteString -> ByteString Source #
Compress the bytestring preferring speed over compression ratio
getAcceptedEncodings :: RequestHeaders -> Set EncodingType Source #
Which encodings can the client accept? The empty set returned here is an error condition and the server tecnically ought to return a 406.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding