Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- newtype MockTimeout = MockTimeout Port
- withMockServer :: Application -> Codensity IO Word16
- ignoreHTTP2NonError :: Maybe Request -> SomeException -> IO ()
- startMockServer :: Maybe TLSSettings -> Application -> IO (IO (), Port)
Documentation
newtype MockTimeout Source #
Thrown in IO by mock federator if the server could not be started after 10 seconds.
Instances
Exception MockTimeout Source # | |
Defined in Network.Wai.Utilities.MockServer | |
Show MockTimeout Source # | |
Defined in Network.Wai.Utilities.MockServer showsPrec :: Int -> MockTimeout -> ShowS # show :: MockTimeout -> String # showList :: [MockTimeout] -> ShowS # | |
Eq MockTimeout Source # | |
Defined in Network.Wai.Utilities.MockServer (==) :: MockTimeout -> MockTimeout -> Bool # (/=) :: MockTimeout -> MockTimeout -> Bool # |
ignoreHTTP2NonError :: Maybe Request -> SomeException -> IO () Source #
startMockServer :: Maybe TLSSettings -> Application -> IO (IO (), Port) Source #
Start a mock warp server on a random port, serving the given Wai application.
If the TLSSettings
argument is provided, start an HTTPS server,
otherwise start a plain HTTP server.
Returns an action to kill the spawned server, and the port on which the server is running.
This function should normally be used within bracket
, e.g.:
bracket (startMockServer Nothing app) fst $ (close, port) ->
makeRequest "localhost" port