http-dispatch-0.5.0.1: High level HTTP client for Haskell

Safe HaskellNone
LanguageHaskell2010

Network.HTTP.Dispatch.Core

Synopsis

Documentation

runRequest :: Runnable a => a -> IO HTTPResponse Source #

get :: Url -> HTTPRequest Source #

Make a simple HTTP GET request

get "http://google.com"

HTTPRequest { reqMethod = GET
            , reqUrl = "http://google.com"
            , reqHeaders = []
            , reqBody = Nothing
            }

getWithHeaders :: String -> [Header] -> HTTPRequest Source #

Make a simple HTTP GET request with headers

  getWithHeaders "http://google.com" [header Content-Type "application/json"]

  HTTPRequest { reqMethod = GET
              , reqUrl = "http://google.com"
              , reqHeaders = [(Content-Type,"application/json")]
              , reqBody = Nothing
              }

post :: Url -> Body -> HTTPRequest Source #

Make a simple HTTP POST request

postWithHeaders :: Url -> Headers -> Body -> HTTPRequest Source #

Make a HTTP POST request with headers

put :: Url -> Body -> HTTPRequest Source #

Make a HTTP PUT request

putWithHeaders :: Url -> Headers -> Body -> HTTPRequest Source #

Make a HTTP PUT request with headers

patch :: Url -> Body -> HTTPRequest Source #

Make a HTTP PATCH request

patchWithHeaders :: Url -> Headers -> Body -> HTTPRequest Source #

Make a HTTP PATCH request with headers

delete :: Url -> HTTPRequest Source #

Make a HTTP DELETE request

deleteWithHeaders :: Url -> Headers -> HTTPRequest Source #

Make a HTTP DELETE request with headers

withQueryParams :: HTTPRequest -> [(String, String)] -> HTTPRequest Source #

Add query params to a request URL

  withQueryParams (get "http://google.com") [("foo", "bar")]

  HTTPRequest { reqMethod = GET
              , reqUrl = "http://google.com?foo=bar"
              , reqHeaders = []
              , reqBody = Nothing
              }