@@ -13,6 +13,36 @@
13* [Contribution](#contribution)
13* [Contribution](#contribution)
14* [License](#license)
14* [License](#license)
17+{-# LANGUAGE OverloadedStrings #-}
18+{-# OPTIONS_GHC -fno-warn-orphans #-}
20+module Main (main) where
22+import Control.Exception (throwIO)
23+import Network.HTTP.Req
26+-- Just make your monad stack an instance of MonadHttp in your application
27+-- and start making requests, enjoy automatic connection sharing.
29+instance MonadHttp IO where
30+ handleHttpException = throwIO
35+ [ "foo" .= (10 :: Int)
36+ , "bar" .= (20 :: Int) ]
37+ -- One function, full power and flexibility.
38+ r <- req POST -- method
39+ (https "httpbin.org" /: "post") -- safe by construction URL
40+ (ReqBodyJson payload) -- use built-in options or add your own
41+ jsonResponse -- specify how to interpret response
42+ mempty -- query params, headers, explicit port number, etc.
43+ print (responseBody r :: Value)
16This is an easy-to-use, type-safe, expandable, high-level HTTP library that
46This is an easy-to-use, type-safe, expandable, high-level HTTP library that
17just works without any fooling around.
47just works without any fooling around.