Mock and modify rules
That are two types of rules that you can setup with tweak: mock and modify.
Mock rule​
This is the default option and the only one 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​
- 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.
- Instant feedback: if you use the delay field with a value of
0
, requests are instant, even when working with a slow network. - 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.
Here's what you can do with the response data and headers:
- Response data
- Forward the original response to the client - leave the response payload empty to forward the original response.
- Use custom JavaScript code to modify a single data property of the server response.
- Re-write the entire response in the response payload tab.
- Response headers
- You can append additional response headers.
- You can override the server's response headers.