Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module is useful for testing by providing a concrete ByteString typed version of MonadDormouseClient
called MonadDormouseTestClient
.
The assumption is that, in most test cases, you probably want to verify the byte payload of the request (which you simply extract
from the request here as a ByteString
) and provide a byte payload (also as a ByteString
) in the response so that you can verify
your repsonse payload can be decoded directly.
An implementation of MonadDormouseTestClient
can be written in terms of either Strict or Lazy Bytestrings at your convenient and the other
will be automatically provided for you.
The machinery in here uses orphan instances of MonadDormouseClient
so you should use this carefully and restrict this module to test
cases only.
Synopsis
- class Monad m => MonadDormouseTestClient m where
- expectLbs :: HttpRequest scheme method ByteString contentTag acceptTag -> m (HttpResponse ByteString)
- expectBs :: HttpRequest scheme method ByteString contentTag acceptTag -> m (HttpResponse ByteString)
Documentation
class Monad m => MonadDormouseTestClient m where Source #
MonadDormouseTestClient describes the capability to send and receive specifically ByteString typed HTTP Requests and Responses
expectLbs :: HttpRequest scheme method ByteString contentTag acceptTag -> m (HttpResponse ByteString) Source #
Make the supplied HTTP request, expecting an HTTP response with a Lazy ByteString body to be delivered in some MonadDormouseTest m
expectBs :: HttpRequest scheme method ByteString contentTag acceptTag -> m (HttpResponse ByteString) Source #
Make the supplied HTTP request, expecting an HTTP response with a Strict ByteString body to be delivered in some MonadDormouseTest m
Orphan instances
(Monad m, MonadIO m, MonadDormouseTestClient m) => MonadDormouseClient m Source # | |
send :: forall url (method :: Symbol) contentTag acceptTag b. IsUrl url => HttpRequest url method RawRequestPayload contentTag acceptTag -> (HttpResponse (SerialT IO Word8) -> IO (HttpResponse b)) -> m (HttpResponse b) Source # |