Popularity
8.6
Growing
Activity
0.0
Stable
1
28
1

Monthly Downloads: 2
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags: Web     Network     IO-Streams     Http    

http-client-streams alternatives and similar packages

Based on the "http" category

Do you think we are missing an alternative of http-client-streams or a related project?

Add another 'http' Package

README

http-client-streams Hackage Build Status

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)