bypass v1.0.0 Bypass

Bypass provides a quick way to create a custom Plug that can be put in place instead of an actual HTTP server to return prebaked responses to client requests.

This module is the main interface to the library.

Link to this section Summary

Functions

Starts an Elixir process running a minimal Plug app. The process is a HTTP handler and listens to requests on a TCP port on localhost

Can be called to immediately verify if the declared request expectations have been met

Link to this section Functions

Link to this function expect(bypass, fun)
Link to this function expect(bypass, methods, paths, fun)
Link to this function expect_once(bypass, fun)
Link to this function expect_once(bypass, methods, paths, fun)
Link to this function open(opts \\ [])

Starts an Elixir process running a minimal Plug app. The process is a HTTP handler and listens to requests on a TCP port on localhost.

Use the other functions in this module to declare which requests are handled and set expectations on the calls.

Link to this function stub(bypass, methods, paths, fun)
Link to this function verify_expectations!(bypass)

Can be called to immediately verify if the declared request expectations have been met.

Returns :ok on success and raises an error on failure.