Popularity
8.5
Stable
Activity
0.0
Stable
1
27
1
Monthly Downloads: 9
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
http-client-streams alternatives and similar packages
Based on the "http" category.
Alternatively, view http-client-streams alternatives based on common mentions on social networks and blogs.
Do you think we are missing an alternative of http-client-streams or a related project?
README
http-client-streams
Usage
{-# LANGUAGE OverloadedStrings #-}
module Main where
import qualified System.IO.Streams as Streams
import System.IO.Streams.HTTP ( opensslManagerSettings
, parseUrl
, withManager
, withHTTP
, responseBody
, withOpenSSL
, context
)
------------------------------------------------------------------------------
-- | OpenSSL test (GET)
main :: IO ()
main = withOpenSSL $ do
req <- parseUrl "https://google.com"
withManager (opensslManagerSettings context) $ \mgr ->
withHTTP req mgr $ \resp ->
Streams.supplyTo Streams.stdout (responseBody resp)
------------------------------------------------------------------------------
-- | OpenSSL test (POST)
post :: IO ()
post = withOpenSSL $ do
let settings =
req <- parseUrl "https://google.com"
let request = req { method = "POST"
, requestBody = stream $ Streams.fromLazyByteString "body"
}
withManager (opensslManagerSettings context) $ \mgr ->
withHTTP request mgr $ \resp ->
Streams.supplyTo Streams.stdout (responseBody resp)