Skip to content
Permalink
master
Go to file
 
 
Cannot retrieve contributors at this time
36 lines (29 sloc) 942 Bytes
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE CPP #-}
module Snooze.Core (
httpGo
, httpGo'
) where
import Data.ByteString.Lazy as BSL
import Network.HTTP.Client
import P
import System.IO
-- Eventually we will want/need to have sensible retries/timeouts here
httpGo :: Manager -> Request -> IO (Response BSL.ByteString)
httpGo mgr req =
httpLbs req {
#if MIN_VERSION_http_client(0,5,0)
#else
checkStatus = _checkStatusIgnore,
#endif
-- Never follow redirects - should always be done by the consumer explicitly if appropriate
redirectCount = 0
} mgr
where
-- A stupid default of http-client is to throw exceptions for non-200
_checkStatusIgnore _ _ _ = Nothing
httpGo' :: Request -> IO (Response BSL.ByteString)
httpGo' req =
newManager defaultManagerSettings >>= flip httpGo req
You can’t perform that action at this time.