The first runResourceT
call is closing the socket before the body is parsed. You will need to combine the two runResourceT
calls into one. ResourceT
is a Monad
instance so you can use do
notation and some minor surgery to free the socket after parsing is complete:
readTask = do
req' <- parseUrl "https://10.64.251.32/rest/api/latest/issue/BNAP-291"
manager <- newManager manSettings
let req'' = applyBasicAuth (pack "sandboxer") (pack "sandboxer") req'
runResourceT $ do
Response _ _ _ body <- http req'' manager
pBody <- body $$+- sinkParser json
liftIO $ print pBody
closeManager manager
return ()
where manSettings =
def
{ managerCheckCerts = \ _ _ -> return CertificateUsageAccept }