Created
November 20, 2016 03:57
-
-
Save caiorss/659502fd588b203bdeaf4d5f9281d3bb to your computer and use it in GitHub Desktop.
http.conduit.post.hs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE OverloadedStrings #-} | |
| import Network.HTTP.Conduit | |
| import qualified Data.ByteString.Lazy.Char8 as L | |
| main :: IO () | |
| main = do | |
| plainRequest <- parseUrl "http://httpbin.org/post" | |
| let enrichedRequest = urlEncodedBody [("foo","bar"),("baz","qux")] plainRequest | |
| response <- withManager $ httpLbs enrichedRequest | |
| putStrLn $ show enrichedRequest | |
| print $ responseStatus response | |
| mapM_ print $ responseHeaders response | |
| L.putStrLn $ responseBody response | |
| return () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment