Skip to main content

tweak blog: mock APIs, debug HTTP and test frontends

Guides on mocking API responses, editing HTTP requests and headers, testing error states and debugging the network in the browser, from the tweak team.

Simulate Delays in HTTP Requests

· 4 min read
Daniel Caldas
Co-founder

There might be a few reasons why we would want to delay an HTTP request:

  • You want to test how your UI behaves to a slow response from an upstream service.
  • There's a race condition in my code, and I suspect that it happens when the request to A is slower than the request B.
  • You want to show off that beautiful loading animation you've been working on all day!

How to Mock API Calls in the Browser (2026 Guide)

· 18 min read
Daniel Caldas
Co-founder

To mock an API call is to answer a request your app makes with a response you wrote, instead of the one the server would send. The app cannot tell the difference: it receives the JSON, the status code and the headers you chose, and renders whatever they lead to.

You need it more often than you would think. The endpoint you are building against does not exist yet. A bug only shows up with a payload you cannot reproduce. The staging server is down on demo day. You want to see the screen for a 500, an empty list or a response that takes eight seconds. In all of these, waiting for the backend is the slow option.

This guide covers what mocking is, the three ways to do it and their trade-offs, then shows step by step how to mock a response right in the browser with tweak: no code, no proxy, no change to your app.