checkOverride method

void checkOverride(
  1. Uri uri
)

Implementation

void checkOverride(Uri uri) {
  dev.log("Checking override for: ${uri.hasQuery}");
  dev.log("Checking override for: ${uri.hasQuery}");
  final isPathMatching = testerResponses.any((response) {
    final responseUri = Uri.parse(response.path);
    final isPathMatching = responseUri.path == uri.path;
    final isQueryMatching = responseUri.query.isEmpty || responseUri.query == uri.query;

    dev.log("isPathMatching: $isPathMatching");
    dev.log("isQueryMatching: $isQueryMatching");

    return isPathMatching && isQueryMatching;
  });

  shouldOverride = isPathMatching;

  if (!isPathMatching) {
    dev.log(
      "Unmocked Endpoint Detected!",
      error: uri.toString(),
      stackTrace: StackTrace.current,
      level: 1000,
    );
  }
}