# Compare requests

> Compare two captured requests or responses side by side in Cloak Proxy, with JSON normalized so key order and formatting don't show up as changes.

Source: https://docs.subcloak.com/cloak-proxy/inspect/compare-requests/

Compare shows two captured requests side by side and highlights every line that differs. Use it to find out why the same call works on one device and fails on another, what changed after a deploy, or which header your app forgot to send the second time.

## Compare two requests

1. In the [traffic list](https://docs.subcloak.com/cloak-proxy/inspect/traffic-list/), select exactly two requests. Click one, then <kbd>⌘</kbd>-click the other.
2. Open the comparison in any of these ways:

   - Right-click one of them and choose **Compare**.
   - Press <kbd>⌥</kbd> <kbd>⌘</kbd> <kbd>D</kbd>.
   - Choose **Tools › Compare Selected Requests**.
   - Press <kbd>⇧</kbd> <kbd>⌘</kbd> <kbd>A</kbd> and run **Compare the Two Selected Requests**.

   The **Compare Requests** window opens with the older request (lower **#**) on the left.

3. Choose **Request** or **Response** at the top to compare that half of the exchange. The window opens on **Response**.

The menu item, shortcut and command are only available when exactly two requests are selected.

> **On Linux:**
> Select the two requests with <kbd>Ctrl</kbd>-click, then right-click and choose **Compare**, or press <kbd>Ctrl</kbd> <kbd>Alt</kbd> <kbd>D</kbd>. Click either side's caption to select that request in the traffic list.

*[Screenshot: The Compare Requests window: request #1 and request #11 to the same users URL, Response selected, Normalize JSON on, 3 changed, 0 added, 2 removed, with the Content-Length line, two Set-Cookie lines, a city and a score highlighted. Two responses from the same endpoint. Removed lines are red on the left, added lines green on the right.]*

## Read the comparison

Each side shows the message as text: the start line (such as `HTTP/2.0 200 OK`), every header, a blank line and the decompressed body. Cloak Proxy lines the two up and marks each line:

| Line | Left side | Right side |
|---|---|---|
| Same | Plain | Plain |
| Changed | Red, marked `−` | Green, marked `+` |
| Removed (only on the left) | Red, marked `−` | Shaded and empty |
| Added (only on the right) | Shaded and empty | Green, marked `+` |

The summary at the top right counts them, for example **3 changed · 0 added · 2 removed**. When the two are the same, it shows **Identical**.

Above the text, each side shows the request's number, method, status code, duration and URL. The URL is selectable.

## Options

| Option | What it does | Default |
|---|---|---|
| **Request** / **Response** | Which half of the exchange to compare | **Response** |
| **Normalize JSON** | Re-indents JSON bodies and sorts their keys before comparing, so formatting and key order don't count as changes. Bodies that aren't JSON are compared as they are. | On |
| **Only changes** | Hides lines that are the same on both sides | Off |
| Swap sides | The arrows between the two captions put the right request on the left | |

**Normalize JSON** and **Only changes** are remembered for next time.

> **Tip:**
> Leave **Normalize JSON** on for APIs. Two responses with the same data often differ in key order or whitespace, and without normalizing, a minified body is a single line that shows as entirely changed.

## What gets compared

- **Bodies are decompressed** first, so a gzip response and a plain one with the same content compare as equal (their `Content-Encoding` header still differs).
- **Headers are compared line by line**, in the order they were sent. A header that moved position shows as removed in one place and added in another.
- **A request without a response** shows `(no response)` on its side when you compare responses.
- **Very large differences** are shown as replaced. When the differing part of two messages is too large to align line by line, Cloak Proxy marks all of it as removed on the left and added on the right.

The window keeps showing the same pair while you go on working, and updates when you compare another pair. If it's opened with nothing to compare, it says **Nothing to compare** and tells you how to choose two requests.

## Compare from an AI assistant

Assistants connected through the [MCP server](https://docs.subcloak.com/cloak-proxy/automation/mcp-server/) can compare two requests by number with the `compare_requests` tool. It returns the differing lines as text, prefixed with `-` and `+`. See the [MCP tools reference](https://docs.subcloak.com/cloak-proxy/automation/mcp-tools-reference/).

## Related

  - [Traffic list](https://docs.subcloak.com/cloak-proxy/inspect/traffic-list/): Select, highlight and comment on requests.
  - [Repeat and Compose](https://docs.subcloak.com/cloak-proxy/tools/repeat-and-compose/): Send a request again and compare the new response with the old one.
  - [Release diff](https://docs.subcloak.com/cloak-proxy/testing/release-diff/): Compare two whole sessions, endpoint by endpoint.
  - [Body viewers](https://docs.subcloak.com/cloak-proxy/inspect/body-viewers/): Look inside each body on its own.
