wai-utilities-0.16.1: Various helpers for WAI
Safe HaskellSafe-Inferred
LanguageGHC2021

Network.Wai.Utilities.MockServer

Synopsis

Documentation

newtype MockTimeout Source #

Thrown in IO by mock federator if the server could not be started after 10 seconds.

Constructors

MockTimeout Port 

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