MockMatch

data class MockMatch(val key: EndpointKey, val config: EndpointConfig)

Represents a matched mock configuration for an incoming HTTP request.

When the network mock plugin intercepts a request, it uses the active environment, the request host, path, and method to find a matching endpoint configuration. If found, this data class contains the necessary information to locate and load the appropriate mock response.

Matching Process

  1. Iterate over all ApiGroupConfig entries in the configuration

  2. For each group, find the EnvironmentConfig whose hostname extracted from EnvironmentConfig.url matches the incoming request host

  3. Build the effective endpoint list for this group+environment (shared + overrides + additions)

  4. Find the EndpointConfig matching the request path and method

  5. Return a MockMatch with the resolved identifiers

Usage in Plugin

val mockMatch = mockRepository.findMatchingMock(
host = "staging.api.example.com",
path = "/v1/users/123",
method = "GET"
)

mockMatch?.let { match ->
val endpointState = currentState.endpointStates[match.key.compositeKey]
// ...
}

See also

Constructors

Link copied to clipboard
constructor(key: EndpointKey, config: EndpointConfig)

Properties

Link copied to clipboard

The complete effective endpoint configuration after override resolution

Link copied to clipboard

The EndpointConfig.id of the matched endpoint. Convenience accessor for EndpointKey.endpointId.

Link copied to clipboard

The EnvironmentConfig.id of the matched environment. Convenience accessor for EndpointKey.environmentId.

Link copied to clipboard

The ApiGroupConfig.id of the matched group. Convenience accessor for EndpointKey.groupId.

Link copied to clipboard

The EndpointKey carrying the matched group, environment, and endpoint identifiers