Tutorials / Features

Rules and breakpoints

Change traffic instead of only watching it: mock a response, rewrite a field, send a host elsewhere, slow the network, or hold a call and edit it.

5 minutes

Add a rule

Right-click any call to add a rule for it, or open Rules and press + New rule. Every rule has an on/off switch, and a live preview shows how many recent calls it would match.

Rules screen showing a Reroute host rule for api.acmeshop.test to 127.0.0.1, with a live preview of the last matching calls

What a rule can do

RuleWhat it does
BreakpointHolds a matching request or response. Edit status, headers or body, then Resume or Abort. A forgotten one is released after 5 minutes.
Mock (map local)Answers from a file or from a recorded response. No server needed.
Redirect (map remote)Sends a host to another one, such as staging.
Modify (rewrite)Sets or removes headers, edits JSON fields, replaces text or the whole body, changes the status, delays the reply.
Reroute host (DNS spoof)Connects to another address while the app still sees the original host, so certificates and Host headers stay intact.
Slow network (throttle)3G, Edge, LTE, lossy LTE, high latency or offline, per rule or for everything.
BlockFails any host or path.

Each call in the list shows a badge for every rule that touched it.

Rewrite one call

  1. Right-click the call and choose Rewrite this call…. The sheet is filled in with its method, host and path.
  2. Use Add change under Request or Response: pick a header or a JSON field from the call itself and type the new value.
  3. Press Save rule. It applies to live traffic at once.

Hold a call

When a breakpoint holds a call, the notch island opens with Continue, Edit… and Abort. From a terminal, lynkei breakpoints wait blocks until something is held.

Rules are a plain file

Everything is saved in rules.yaml (Edit YAML opens it), so the same rules work from the command line and for agents.

rules.yaml
version: 1
rules:
  - { id: no-ads, kind: block, match: { host: ads.example.com } }
  - id: mock-products
    kind: map_local
    match: { path: /v2/products }
    file: products.json
  - id: flags
    kind: rewrite
    match: { path: /v2/feature-flags }
    actions:
      - set_json: { path: $.flags.new_checkout, value: true }
  - { id: staging, kind: map_remote, match: { host: api.acme.com }, to: "https://staging.acme.com" }
  - { id: slow, kind: throttle, match: { path: /images }, profile: 3g }