downloadJSON :: (FromJSON a, MonadReader env m, HasHttpManager env, MonadIO m, MonadMask m)
             => Request
             -> m a
downloadJSON req = do
    val <- recoveringHttp drRetryPolicyDefault $
        liftHTTP $ withResponse req $ \res ->
            responseBody res $$ sinkParser json'
    case parseEither parseJSON val of
        Left e -> throwM $ DownloadJSONException req e
        Right x -> return x
downloadJSON :: (FromJSON a, MonadReader env m, HasHttpManager env, MonadIO m, MonadMask m)
             => Request
             -> m a
downloadJSON req = do
    val <- recoveringHttp drRetryPolicyDefault $
        liftHTTP $ withResponse req $ \res ->
            responseBody res $$ sinkParser json'
    case parseEither parseJSON val of
        Left e -> throwM $ DownloadJSONException req e
        Right x -> return x
downloadJSON req = do
    val <- recoveringHttp drRetryPolicyDefault $
        liftHTTP $ withResponse req $ \res ->
            responseBody res $$ sinkParser json'
    case parseEither parseJSON val of
        Left e -> throwM $ DownloadJSONException req e
        Right x -> return x