Skip to content

Instantly share code, notes, and snippets.

@proger
Last active January 24, 2016 22:40
Show Gist options
  • Save proger/271f1e1d479c7a7678f2 to your computer and use it in GitHub Desktop.
Save proger/271f1e1d479c7a7678f2 to your computer and use it in GitHub Desktop.
debug servant-client requests
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE StandaloneDeriving #-}
module Realm.Newrelic where
import Control.Monad.Trans.Either
import Data.Proxy
import Data.Text (Text)
import Servant.API
import Servant.Client
import Servant.Common.Req
type DeploymentParams = [(Text, Text)]
type Deployments = "deployments.xml"
:> ReqBody '[FormUrlEncoded] DeploymentParams
:> Post '[PlainText] Text
:> Debug
data Debug
deriving instance Show Req
instance HasClient (Post a b :> Debug) where
type Client (Post a b :> Debug) = Req
clientWithRoute Proxy req baseurl = req
api :: Proxy Deployments
api = Proxy
postDeployment :: Req
postDeployment = client api (BaseUrl Https "api.newrelic.com" 443) [("app_name", "meh")]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment