EndpointConfiguration

data class EndpointConfiguration(val name: String, val key: EndpointConfiguration.Key, val shouldFail: Boolean, val delay: Int? = null, val dashboardOptionsConfig: DashboardOptionsConfig, val versionCode: Int, val endpointMatcher: suspend MockzillaHttpRequest.() -> Boolean, val defaultHandler: suspend MockzillaHttpRequest.() -> MockzillaHttpResponse, val errorHandler: suspend MockzillaHttpRequest.() -> MockzillaHttpResponse)

Configures a single mock endpoint within a Mockzilla server. Defines how incoming requests are matched to this endpoint and what response to return, along with optional dashboard presets and latency simulation.

Construct via Builder.

Constructors

Link copied to clipboard
constructor(name: String, key: EndpointConfiguration.Key, shouldFail: Boolean, delay: Int? = null, dashboardOptionsConfig: DashboardOptionsConfig, versionCode: Int, endpointMatcher: suspend MockzillaHttpRequest.() -> Boolean, defaultHandler: suspend MockzillaHttpRequest.() -> MockzillaHttpResponse, errorHandler: suspend MockzillaHttpRequest.() -> MockzillaHttpResponse)

Types

Link copied to clipboard
class Builder(key: String)
Link copied to clipboard
@Serializable
value class Key(val raw: String)

Unique serializable identifier for an EndpointConfiguration. Used to reference endpoints in management API operations such as cache clearing or runtime overrides.

Properties

Link copied to clipboard

Preset responses available to users in the management dashboard.

Link copied to clipboard

Called when a request matches this endpoint and shouldFail is false. Returns the mock response to send back to the caller.

Link copied to clipboard
val delay: Int?

Artificial response delay in milliseconds. null falls back to the global delay set on MockzillaConfig.Builder.

Link copied to clipboard

Predicate that determines whether an incoming request should be routed to this endpoint. The first matching endpoint wins.

Link copied to clipboard

Called when a request matches this endpoint and shouldFail is true. Returns the simulated error response to send back to the caller.

Link copied to clipboard

Unique identifier for this endpoint, used in management API operations.

Link copied to clipboard

Human-readable display name shown in the management dashboard.

Link copied to clipboard

Whether this endpoint returns an error response by default. When true, errorHandler is called instead of defaultHandler.

Link copied to clipboard

Version number for this endpoint's configuration. Incrementing this value automatically invalidates any cached responses on connected devices.