MockMatch
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
Iterate over all ApiGroupConfig entries in the configuration
For each group, find the EnvironmentConfig whose hostname extracted from EnvironmentConfig.url matches the incoming request host
Build the effective endpoint list for this group+environment (shared + overrides + additions)
Find the EndpointConfig matching the request path and method
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
Properties
The complete effective endpoint configuration after override resolution
The EndpointConfig.id of the matched endpoint. Convenience accessor for EndpointKey.endpointId.
The EnvironmentConfig.id of the matched environment. Convenience accessor for EndpointKey.environmentId.
The ApiGroupConfig.id of the matched group. Convenience accessor for EndpointKey.groupId.
The EndpointKey carrying the matched group, environment, and endpoint identifiers