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

Copyright(c) 2016 Owain Lewis
LicenseBSD-style
Maintainerowain@owainlewis.com
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell2010

Network.HTTP.Dispatch.Request

Description

HTTP request generation DSL

Synopsis

Documentation

rawRequest :: HTTPRequestMethod -> String -> [Header] -> Maybe ByteString -> HTTPRequest Source #

Make a raw HTTP request

  raw GET "http://google.com" [header Content-Type "application/json"] Nothing

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

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

Make a simple HTTP GET request with headers

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

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

postRequest :: Url -> Headers -> Maybe ByteString -> HTTPRequest Source #

Make a HTTP POST request with headers

putRequest :: Url -> Headers -> Maybe ByteString -> HTTPRequest Source #

Make a HTTP PUT request with headers

patchRequest :: Url -> Headers -> Maybe ByteString -> HTTPRequest Source #

Make a HTTP PATCH request with headers

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

Make a HTTP DELETE request with headers

headRequest :: Url -> [Header] -> HTTPRequest Source #

Make a HTTP HEAD request

optionsRequest :: Url -> [Header] -> HTTPRequest Source #

Make a HTTP OPTIONS request

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
              }