wrecker-1.3.1.0: An HTTP Performance Benchmarker

Safe HaskellNone
LanguageHaskell2010

Network.Wreq.Wrecker

Contents

Description

This is a copy of the wreq Session, but each call is wrapped in wrecker's record function.

This file was initially copied from Network.Wreq.Session (c) 2014 Bryan O'Sullivan. See the source for the full copy right info.

Synopsis

Documentation

data Session Source #

An opaque type created by withWreq, withWreqNoCookies, or withWreqSettings. All HTTP calls require a Session.

defaultManagerSettings :: ConnectionContext -> ManagerSettings Source #

Create ManagerSettings with no timeout using a shared TLS ConnectionContext

withRecordFunction :: (forall a. Recorder -> String -> IO a -> IO a) -> Session -> Session Source #

Replaces the record function of the Session with the provided one.

This is useful for custom recorder actions, or if you need to catch any exceptions thrown by the IO action and don't wish them to bubble up to the statistics.

Session Creation

withWreq :: (Session -> IO a) -> Environment -> IO a Source #

Create a Session using the wrecker Environment, passing it to the given function. The Session will no longer be valid after that function returns.

This session manages cookies and uses default session manager configuration.

withWreqNoCookies :: (Session -> IO a) -> Environment -> IO a Source #

Create a session.

This uses the default session manager settings, but does not manage cookies. It is intended for use with REST-like HTTP-based APIs, which typically do not use cookies.

withWreqSettings Source #

Arguments

:: Recorder 
-> Logger 
-> Maybe CookieJar

If Nothing is specified, no cookie management will be performed.

-> ManagerSettings 
-> (Session -> IO a) 
-> IO a 

Create a session, using the given cookie jar and manager settings.

Logging functions

logDebug :: ToLogStr msg => Session -> msg -> IO () Source #

logInfo :: ToLogStr msg => Session -> msg -> IO () Source #

logWarn :: ToLogStr msg => Session -> msg -> IO () Source #

logError :: ToLogStr msg => Session -> msg -> IO () Source #

HTTP Methods

get :: Session -> String -> IO (Response ByteString) Source #

Session-specific version of get.

post :: Postable a => Session -> String -> a -> IO (Response ByteString) Source #

Session-specific version of post.

head_ :: Session -> String -> IO (Response ()) Source #

Session-specific version of head_.

options :: Session -> String -> IO (Response ()) Source #

Session-specific version of options.

put :: Putable a => Session -> String -> a -> IO (Response ByteString) Source #

Session-specific version of put.

delete :: Session -> String -> IO (Response ByteString) Source #

Session-specific version of delete.

HTTP Methods with Options

postWith :: Postable a => Options -> Session -> String -> a -> IO (Response ByteString) Source #

Session-specific version of postWith.

headWith :: Options -> Session -> String -> IO (Response ()) Source #

Session-specific version of headWith.

optionsWith :: Options -> Session -> String -> IO (Response ()) Source #

Session-specific version of optionsWith.

putWith :: Putable a => Options -> Session -> String -> a -> IO (Response ByteString) Source #

Session-specific version of putWith.

HTTP Methods to get JSON responses

getJSON :: FromJSON a => Session -> String -> IO (Response a) Source #

Session-specific version of get that expects a JSON response.

getJSONWith :: FromJSON a => Options -> Session -> String -> IO (Response a) Source #

Session-specific version of getWith that expects a JSON response.

postJSON :: (Postable a, FromJSON b) => Session -> String -> a -> IO (Response b) Source #

Session-specific version of post that expects a JSON response.

postJSONWith :: (Postable a, FromJSON b) => Options -> Session -> String -> a -> IO (Response b) Source #

Session-specific version of postWith that expects a JSON response.

putJSON :: (Putable a, FromJSON b) => Session -> String -> a -> IO (Response b) Source #

Session-specific version of put that expects a JSON response.

putJSONWith :: (Putable a, FromJSON b) => Options -> Session -> String -> a -> IO (Response b) Source #

Session-specific version of putWith that expects a JSON response.

deleteJSON :: FromJSON a => Session -> String -> IO (Response a) Source #

Session-specific version of delete that expects a JSON response.

deleteJSONWith :: FromJSON a => Options -> Session -> String -> IO (Response a) Source #

Session-specific version of deleteWith that expects a JSON response.