mockRuleMatches function

bool mockRuleMatches(
  1. MockRule rule,
  2. String method,
  3. String url, [
  4. String? appId,
])

Reference matcher (identical semantics in every SDK):

  • method: * matches anything, otherwise case-insensitive equality;
  • contains / exact / glob: case-insensitive; glob * = any run of chars (incl. /), ? = one char, and must match the WHOLE url;
  • regex: pattern used as-is (case-sensitive), searched anywhere in the url; an invalid regex never matches;
  • apps: empty/null = all apps, otherwise must contain appId;
  • conditions (when): every one must hold; graphql = one of the request's GraphQL operations has that name (and type). Without a body (this function) only a GET request's URL can name the operation; an operation that cannot be read never matches, nor does an unknown condition key.

Implementation

bool mockRuleMatches(MockRule rule, String method, String url, [String? appId]) =>
    mockRuleMatchesRequest(rule, MockRequestInput(method: method, url: url, appId: appId));