Evaluation engine for mock and expectation rules.
It is responsible for:
- matching incoming HTTP requests against configured rules
- supporting sequence responses (lists) and callback functions
- tracking usage counts for expectations
- returning a concrete response specification for the connection layer
Summary
Functions
Applies mock/expectation rules according to the given mode.
Types
@type result() :: %{ response: term(), rule_id: reference() | nil, rules: [HttpDouble.MockRule.t()] }
Result of rule evaluation.
Functions
@spec apply( [HttpDouble.MockRule.t()], HttpDouble.Request.t(), non_neg_integer(), :mock_first | :mock_only | :routes_only, (-> {term(), reference() | nil} | {:no_route, term()}) ) :: result()
Applies mock/expectation rules according to the given mode.
Modes:
:mock_first– try rules, fall back tofallback.()when no match:mock_only– try rules, return{:no_route, default}when no match:routes_only– ignore rules, always callfallback.()