Skip to main content

How to answer instead of your service and test it against failures

Since app version 1.4.0

Add a stub rule in the inspector: matching requests get your answer without the service, a delay or a failure. Stubs work on the Pro and Ultra plans (what the inspector does for free).

How to add a stub​

  1. Open an HTTPS tunnel's "Requests" tab (how to open the inspector) and the "Stubs" view.
  2. Click "Add" and pick what to do with a request; the "New stub" window opens:
    • "Stub — custom response": the visitor gets your answer, and the service gets nothing;
    • "Delay for a while": the request waits, then goes to the service as usual;
    • "Fail every Nth": every Nth request gets a failure, and the others go on to the next rules and the service;
    • "Service down — 503": when the service does not take the request, for example because it is off, the visitor gets 503 with Retry-After.
  3. In "Methods" and "Path", say which requests the rule is for. An empty path means any; without *, a path containing that text matches; with *, the whole path is matched as a pattern, for example /api/v1/orders/*.
  4. Fill in the action's fields:
    • custom response: "Status code" from 200 to 599, "Body type", "Headers" and "Response body";
    • delay: "Delay, ms", from 1 to 60,000;
    • failure: "Every Nth request" (1 means every one) and "How to fail": "Error code" from 400 to 599 or "Drop the connection";
    • service down: "Retry-After, sec.", from 1 to 3600, how many seconds until the visitor should try again.
  5. Click "Save". The rule goes to the end of the "Stub rules" list, turned on.

How the rules work​

  • The first matching rule that is on acts, so the order matters: drag a row by the handle on its left to change it. There can be up to 50 rules.
  • In the log, a request a rule answered is marked "stub": it never reached the service.
  • To turn a rule off, use the switch in its row; to delete it, "⋯" → "Delete".
  • How many times a rule fired shows in the "Hits" column of the rule list.
  • Rules last while the tunnel is open: once it closes or you sign out, they are gone. When the Pro or Ultra plan ends, the rules stop acting and requests go to the service as usual.
  • Rules act on connections opened while the tunnel has a stub or pause rule on: a connection your browser has held since before is not touched until the browser opens a new one.

Check​

Send a request that matches the rule to the tunnel's link: with a custom response you get your code and body, with a failure on every second request the service's answer and the error take turns. In the log, those requests carry the "stub" mark.