Package-level declarations

Types

Link copied to clipboard
@Serializable
data class DashboardOptionsConfig(val errorPresets: List<DashboardOverridePreset>, val successPresets: List<DashboardOverridePreset>)

Configures the preset responses available to users in the Mockzilla management dashboard for a specific endpoint. Presets let dashboard users quickly switch between common response scenarios without modifying code.

Link copied to clipboard
@Serializable
data class DashboardOverridePreset(val name: String, val description: String?, val type: DashboardOverridePreset.Type?, val response: PartialMockzillaHttpResponse, val isManagementUiDefinedCustomPreset: Boolean = false)

A named response configuration that can be applied to an endpoint from the Mockzilla management dashboard, overriding the endpoint's default or error response for a session.

Link copied to clipboard
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.

Link copied to clipboard
@Serializable
data class MetaData(val appName: String, val appPackage: String, val operatingSystemVersion: String, val deviceModel: String, val appVersion: String, val runTarget: RunTarget? = null, val mockzillaVersion: String)

Device and application metadata collected when Mockzilla starts. Displayed in the management dashboard to identify the connected device, and used in ZeroConf service records.

Link copied to clipboard
data class MockzillaConfig(val port: Int, val endpoints: List<EndpointConfiguration>, val isRelease: Boolean, val localhostOnly: Boolean, val logLevel: MockzillaConfig.LogLevel, val releaseModeConfig: MockzillaConfig.ReleaseModeConfig, val isNetworkDiscoveryEnabled: Boolean, val additionalLogWriters: List<MockzillaLogWriter>)

Top-level configuration for a Mockzilla server instance. All properties are set via MockzillaConfig.Builder.

Link copied to clipboard
Link copied to clipboard
@Serializable
data class MockzillaHttpResponse(val statusCode: HttpStatusCode = HttpStatusCode.OK, val headers: Map<String, String> = emptyMap(), val body: String = "")

An HTTP response returned by a mock endpoint handler. Returned from EndpointConfiguration.Builder.setDefaultHandler and EndpointConfiguration.Builder.setErrorHandler lambdas.

Link copied to clipboard
data class MockzillaRuntimeParams(val config: MockzillaConfig, val ip: String, val mockBaseUrl: String, val apiBaseUrl: String, val port: Int, val authHeaderProvider: AuthHeaderProvider, val mockzillaVersion: String)

Runtime details of a started Mockzilla server, returned by startMockzilla. Use mockBaseUrl as the base URL in the app under test's HTTP client to route requests through the mock server.

Link copied to clipboard
@Serializable
data class PartialMockzillaHttpResponse(val statusCode: HttpStatusCode? = null, val headers: Map<String, String>? = null, val body: String? = null)

A partial HTTP response used by dashboard presets, allowing a subset of response fields to be overridden. null fields are left unchanged from the endpoint's default response.

Link copied to clipboard
class PortConflictException(val port: Int, val cause: Throwable?) : RuntimeException

Thrown when attempting to start the Mockzilla server on a port that is occupied by another process. To resolve, either terminate the process occupying the port or update your MockzillaConfig.

Link copied to clipboard

Identifies the platform on which the Mockzilla server is running. Reported in MetaData and visible in the management dashboard.