Skip to main content

Mock and modify rules

There are four types of rules that you can set up with tweak. Mock and modify are the flagship ones: they allow for a broad range of data and flow modifications across Fetch and XHR requests, and they are what the rest of this section documents.

The other two are more specialized and are applied by the browser rather than by tweak inside the page. See headers only rules and redirect rules, or the comparison of all four.

Mock rule​

This is the default option and available in the free version. In a mock rule, the intercepted request never leaves the browser and the extension fully replaces the server.

How it works​

tweak intercepts the request from the application, applies the settings, and forwards the response back to the application.

Advantages​

  1. You can hit the fake server as many times as you want, without being concerned of overloading a service or polluting the server logs with test data.
  2. Instant feedback: if you use the delay field with a value of 0, requests are instant, even when working with a slow network.
  3. You can work offline, if your application runs locally.

Modify rule​

note

Modify rules are only available on paid plans. Check our plans here.

Modify rules allow you to tap into a HTTP request and modify it. They offer a broader range of capabilities compared to mock rules. In fact, a modify rule could do exactly what a mock rule does, but not vice-versa.

What can be modified:

  • Request URL - can be modified through a request hook.
  • Request payload - can be modified through the "Request payload" tab or through a request hook.
  • Request headers - can be modified through the "Request headers" tab or through a request hook.
  • Response data.
  • Response headers.

modify rule interface changes

Here's what you can do with the response data and headers:

  • Response data
  • Response headers
    • You can append additional response headers.
    • You can override the server's response headers.


Was this page helpful?

Need something else? Request a feature