Safe Haskell | None |
---|
- with :: IO a -> SpecWith a -> Spec
- get :: ByteString -> WaiSession SResponse
- post :: ByteString -> ByteString -> WaiSession SResponse
- put :: ByteString -> ByteString -> WaiSession SResponse
- request :: Method -> ByteString -> ByteString -> WaiSession SResponse
- shouldRespondWith :: WaiSession SResponse -> ResponseMatcher -> WaiExpectation
- data ResponseMatcher = ResponseMatcher {
- matchStatus :: Int
- matchHeaders :: [Header]
- matchBody :: Maybe ByteString
Documentation
get :: ByteString -> WaiSession SResponseSource
| Performs GET
request to running app.
post :: ByteString -> ByteString -> WaiSession SResponseSource
| Performs POST
request to running app.
put :: ByteString -> ByteString -> WaiSession SResponseSource
| Performs PUT
request to running app.
request :: Method -> ByteString -> ByteString -> WaiSession SResponseSource
| Performs request to running app, with HTTP Method, path and body.
shouldRespondWith :: WaiSession SResponse -> ResponseMatcher -> WaiExpectationSource
Passs if
- the given number matches with the HTTP Status code of the response.
* the given string matches with the body of the response.
* the given
ResponseMatcher
matches with the response.
Example:
get "/foo" `shouldRespondWith` 200 -- Pass get "/foo" `shouldRespondWith` "bar" -- Pass if the body is "bar" get "/foo" `shouldRespondWith` "bar" { matchStatus = 200 } -- Pass if the body is "bar" and status is 200