Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Type and functions for handling gzipped HTTP responses
In order to optimize caching of responses in storage with size limitations,
we cache gzipped responses as-is. This requires disabling the automatic
decompression of http-client
and handling it ourselves.
The module makes that a type-enforced process:
requestPotentiallyGzipped
is the only way to get aPotentiallyGzipped
- Which is the type needed for the response field in
CachedResponse
gunzipResponseBody
is the only way to erasePotentiallyGzipped
- Which is what you actually need to return
Synopsis
- data PotentiallyGzipped a
- requestPotentiallyGzipped :: Functor m => (Request -> m (Response body)) -> Request -> m (Response (PotentiallyGzipped body))
- gunzipResponseBody :: MonadIO m => Request -> Response (PotentiallyGzipped ByteString) -> m (Response ByteString)
Documentation
data PotentiallyGzipped a Source #
Instances
Show a => Show (PotentiallyGzipped a) Source # | |
Defined in Freckle.App.Http.Cache.Gzip showsPrec :: Int -> PotentiallyGzipped a -> ShowS # show :: PotentiallyGzipped a -> String # showList :: [PotentiallyGzipped a] -> ShowS # | |
Eq a => Eq (PotentiallyGzipped a) Source # | |
Defined in Freckle.App.Http.Cache.Gzip (==) :: PotentiallyGzipped a -> PotentiallyGzipped a -> Bool # (/=) :: PotentiallyGzipped a -> PotentiallyGzipped a -> Bool # | |
Serialise a => Serialise (PotentiallyGzipped a) Source # | |
Defined in Freckle.App.Http.Cache.Gzip encode :: PotentiallyGzipped a -> Encoding # decode :: Decoder s (PotentiallyGzipped a) # encodeList :: [PotentiallyGzipped a] -> Encoding # decodeList :: Decoder s [PotentiallyGzipped a] # |
requestPotentiallyGzipped :: Functor m => (Request -> m (Response body)) -> Request -> m (Response (PotentiallyGzipped body)) Source #
Run a request without automatic decompress
and tag the body
type
gunzipResponseBody :: MonadIO m => Request -> Response (PotentiallyGzipped ByteString) -> m (Response ByteString) Source #
Gunzip a PotentiallyGzipped
body, if necessary