Function pact_mock_server::start_mock_server

source ·
pub fn start_mock_server(
    id: String,
    pact: Box<dyn Pact + Send + Sync>,
    addr: SocketAddr
) -> Result<i32, String>
Expand description

Starts a mock server with the given ID, pact and port number. The ID needs to be unique. A port number of 0 will result in an auto-allocated port by the operating system. Returns the port that the mock server is running on wrapped in a Result.

  • id - Unique ID for the mock server.
  • pact - Pact model to use for the mock server.
  • addr - Socket address that the server should listen on.

§Errors

An error with a message will be returned in the following conditions:

  • If a mock server is not able to be started