View Source TestServer (TestServer v0.1.0)
No fuzz ExUnit test server to mock third party services.
Features:
- HTTP/1
- HTTP/2
- Built-in TLS with self-signed certificates
- Plug route matching
Link to this section Summary
Functions
Adds a route to the test server.
Start a test server instance.
Shuts down the current test server instance
Shuts down a test server instance
Produces a URL for the test server instance.
Fetches the generated x509 suite for the current test server instance.
Fetches the generated x509 suite for a test server instance.
Link to this section Functions
Adds a route to the test server.
options
Options
:via- matches the route against some specific HTTP method(s) specified as an atom, like:getor:put, or a list, like[:get, :post].:match- an anonymous function that will be called to see if a route matches, defaults to matching with arguments of uri and:viaoption.:to- a Plug or anonymous function that will be called when the route matches.
Start a test server instance.
The instance will be terminated when the test case finishes.
options
Options
:port- integer of port number, defaults to random port that can be opened;:scheme- an atom for the http scheme. Defaults to:http;:cowboy_options- See Cowboy docs
@spec stop() :: :ok | {:error, term()}
Shuts down the current test server instance
Shuts down a test server instance
@spec url() :: binary()
Produces a URL for the test server instance.
options
Options
:host- binary host value, it'll be added to inet for IP 127.0.0.1, defaults to"localhost";
@spec x509_suite() :: term()
Fetches the generated x509 suite for the current test server instance.
Fetches the generated x509 suite for a test server instance.