MockRule

interface MockRule

A read-only view of a network mock rule.

Library-constructed: the concrete implementation is internal in :lustro. Consumers read these properties to inspect configured mocks.

Properties

Link copied to clipboard
abstract val enabled: Boolean

Whether the rule is currently active.

Link copied to clipboard
open val failure: String?

The connection error the rule fails a matching request with, in place of a response, or null for a rule that answers with statusCode, responseHeaders, and responseBody, which a failure rule ignores.

Link copied to clipboard
abstract val hitCount: Int

How many times this rule has matched a request.

Link copied to clipboard
abstract val id: String

The stable rule id.

Link copied to clipboard
abstract val method: String?

The HTTP method to match, or null to match any method.

Link copied to clipboard
abstract val name: String

The human-readable rule name.

Link copied to clipboard
abstract val responseBody: String

The response body returned by the mock.

Link copied to clipboard
abstract val responseHeaders: Headers

The headers returned by the mock.

Link copied to clipboard
abstract val statusCode: Int

The HTTP status code returned by the mock.

Link copied to clipboard
abstract val urlPattern: String

The URL match pattern, looked for anywhere in the request URL: as a substring, or as a regular expression when prefixed with regex:. A regular expression that must match the whole URL anchors itself with ^ and $.