# Repeat and Compose

> Send a captured request again, many times at once, or edited first, or write a new one in Compose. Every request goes through your debugging tools.

Source: https://docs.subcloak.com/cloak-proxy/tools/repeat-and-compose/

Repeat sends a captured request again, exactly as recorded, and Repeat Advanced sends it many times with a summary of the results. Edit and Repeat opens it in Compose so you can change it first, and Compose lets you write a request from scratch or from a cURL command. Every request you send this way goes through Cloak Proxy and your [debugging tools](https://docs.subcloak.com/cloak-proxy/tools/overview/), and appears in the traffic list like live traffic. Use them to check a fix, reproduce a bug, or try a rule without touching the app.

## Repeat a request

1. Select one or more requests in the traffic list.

2. Choose **Proxy › Repeat Selected Request** or press <kbd>⌘</kbd> <kbd>R</kbd>.

   You can also right-click and choose **Repeat** (or **Repeat N Requests** with several selected), or search for **Repeat Selected Request** in [Search Everything](https://docs.subcloak.com/cloak-proxy/inspect/search-and-command-palette/).

3. Each request is sent again with its recorded method, URL, headers and body. The new requests appear in the traffic list with the app **Cloak Proxy (Repeat)**.

The original rows aren't changed. Encrypted tunnels can't be repeated, because Cloak Proxy never saw the requests inside them.

> **Note:**
> Repeat sends the body as recorded. If a body was larger than the **Max captured body size** in [Network settings](https://docs.subcloak.com/cloak-proxy/capture/network-settings/), it was recorded cut short and is sent cut short.

## Repeat a request many times

(added in Cloak Proxy 0.2.0)

Repeat Advanced sends one captured request up to 10,000 times, up to 100 at once, and sums up what came back: the status codes, failures and response times. Use it to check a rate limit, look for race conditions such as a double-submitted order, see how response times spread under load, or confirm that a fix holds over many tries.

1. Right-click a request in the traffic list and choose **Repeat Advanced…**. You can also select it and choose **Proxy › Repeat Advanced…** or press <kbd>⇧</kbd> <kbd>⌥</kbd> <kbd>⌘</kbd> <kbd>R</kbd>.

2. Set how many requests to send, how many at the same time, and the delay between starts.

3. Click **Send** followed by the number, or press <kbd>↩</kbd>.

4. Watch the progress bar and the summary fill in. Click **Stop** to stop early.

5. When it's done, click **Show in Traffic List** to select the requests that were sent and close the sheet.

*[Screenshot: The Repeat Advanced sheet for GET https://api.example.com/v1/users?page=1&limit=2&sort=name with Requests 10, At the same time 1 and Delay between starts 0 ms, and Close and Send 10 buttons. Repeat Advanced: send one request many times, one or many at once.]*

### Settings

| Setting | Range | Default | What it does |
|---|---|---|---|
| **Requests** | 1 to 10,000 | 10 | How many times to send the request. |
| **At the same time** | 1 to 100 | 1 | How many requests can be waiting for a response at once. When one finishes, the next one starts. With 1, requests go one after another. |
| **Delay between starts** | 0 to 60,000 ms, in steps of 50 | 0 ms | How long to wait before starting each request after the first. |

Cloak Proxy remembers your settings for next time. They're locked while a run is in progress.

### The summary

| Row | Shows |
|---|---|
| Progress bar | How many requests have finished, out of the total. |
| **Sent** | Finished requests out of the total, and the time so far in seconds, for example `100 of 100 in 4.2 s`. |
| **Status** | How many responses had each status code, for example `200 × 95   429 × 5`. Requests that got no response, such as a dropped connection, a request aborted at a breakpoint, or a server that couldn't be reached, are counted as `failed × N`. |
| **Time** | The fastest (`min`), average (`avg`), 95th percentile (`p95`) and slowest (`max`) response time, in milliseconds. |

**Stop** stops new requests from starting. Requests already sent still finish and appear in the traffic list.

### How the requests are sent

- Each request is a copy of the captured one: same method, URL, headers and body.
- Every request goes through your [debugging tools](https://docs.subcloak.com/cloak-proxy/tools/overview/) and appears in the traffic list with the app **Cloak Proxy (Repeat)**, like a normal [Repeat](#repeat-a-request).
- Encrypted tunnels can't be repeated, so the menu items are unavailable for them.

> **Tip:**
> Check your tools before a big run. A [breakpoint](https://docs.subcloak.com/cloak-proxy/tools/breakpoint/) that matches the request pauses every copy, and [Network Conditions](https://docs.subcloak.com/cloak-proxy/tools/network-conditions/) slows every copy down. Turn them off first unless that's what you want to test.

> **Only test servers you may test:**
> Repeat Advanced sends real requests to the real server, as fast as you set it to. Many requests at once can trip rate limits, lock accounts, create duplicate orders or messages, or slow a service down for other people. Only send repeated requests to servers you own or have written permission to test, preferably a test or staging server. Point requests there with [Map Remote](https://docs.subcloak.com/cloak-proxy/tools/map-remote/) if needed.

## Edit and repeat a request

1. Select a request in the traffic list.

2. Choose **Proxy › Edit and Repeat…** or press <kbd>⌥</kbd> <kbd>⌘</kbd> <kbd>E</kbd>. You can also right-click it and choose **Edit and Repeat…**.

3. The Compose window opens with the request's method, URL, headers and body. The body is decompressed to readable text, and the `Content-Length`, `Connection` and `Proxy-Connection` headers are left out.

4. Change what you need and click **Send** (<kbd>⌘</kbd> <kbd>↩</kbd>).

## Compose a new request

Choose **File › Compose Request** or press <kbd>⌥</kbd> <kbd>⌘</kbd> <kbd>N</kbd>. A new request starts as `GET https://` with the header `Accept: */*`.

*[Screenshot: The Compose window with a POST to https://api.example.com/v1/orders?expand=items, one Content-Type header, and a JSON response shown below in the tree viewer. Compose: the request on top, the response below.]*

### Request

| Control | What it does |
|---|---|
| Method | **GET**, **POST**, **PUT**, **PATCH**, **DELETE**, **HEAD** or **OPTIONS**. |
| URL | The full URL, including the query string. Press <kbd>↩</kbd> in the field to send. Pasting a whole `curl …` command here imports it. |
| **Import cURL…** | Opens a sheet where you paste a curl command. See [Import a curl command](#import-a-curl-command). |
| **Send** | Sends the request (<kbd>⌘</kbd> <kbd>↩</kbd>). Disabled until the URL has a host, and while a request is being sent. |

| Tab | What it shows |
|---|---|
| **Headers** | The headers, with their count on the tab. Click **Add** for a new one; click the minus button to remove one. Headers with an empty name aren't sent. |
| **Query** | The URL's query parameters as name and value pairs. **Add** adds a `name=value` pair to edit. Changes update the URL. |
| **Body** | The body as text. JSON shows **Valid JSON** with **Format** and **Minify**, or **Invalid JSON**. |
| **cURL** | The request as a curl command, kept in sync with your edits. |

If the body is valid JSON and you haven't set a `Content-Type` header, Cloak Proxy adds `Content-Type: application/json` when you send.

(added in Cloak Proxy 0.4.0) A Protobuf `Content-Type` (gRPC, gRPC-Web, Connect, `application/x-protobuf`) lets you write the body as JSON; it's encoded when you send. Edit and Repeat opens a captured Protobuf body as JSON. See [Edit Protobuf and gRPC](https://docs.subcloak.com/cloak-proxy/inspect/protobuf-and-grpc/).

### Response

After you send, the bottom half shows the result: the method, URL, status, duration and size, and the response tabs and [body viewers](https://docs.subcloak.com/cloak-proxy/inspect/body-viewers/) you know from the [inspector](https://docs.subcloak.com/cloak-proxy/inspect/inspector/). Before the first send it says **Send the request to see the response here.**

The request also appears in the main traffic list with the app **Cloak Proxy (Compose)**.

### Import a curl command

1. Copy a curl command, for example with **Copy as cURL** in a browser's developer tools.

2. Click **Import cURL…**. If the clipboard holds a curl command, it's already pasted in.

3. Click **Import**. The method, URL, headers and body fill the Compose window.

You can also paste the command straight into the URL field. If the command can't be read, Compose shows **Couldn't import that curl command** with the reason. The sheet's description lists where commands usually come from: Chrome, Safari or Firefox (**Copy as cURL**), API docs, or a teammate. See [Import](https://docs.subcloak.com/cloak-proxy/sessions/import/) for the curl options Cloak Proxy understands.

The Compose window keeps your request while Cloak Proxy is running. **Edit and Repeat** replaces it with the selected request.

## Sent requests go through your tools

Repeated and composed requests take the same path as live traffic, so every enabled tool applies:

- A [breakpoint](https://docs.subcloak.com/cloak-proxy/tools/breakpoint/) pauses them, [scripts](https://docs.subcloak.com/cloak-proxy/tools/scripting/) change them, and [Map Local](https://docs.subcloak.com/cloak-proxy/tools/map-local/) or a [mock set](https://docs.subcloak.com/cloak-proxy/tools/mock-sets/) can answer them without the network.
- [Map Remote](https://docs.subcloak.com/cloak-proxy/tools/map-remote/) and [DNS Spoofing](https://docs.subcloak.com/cloak-proxy/tools/dns-spoofing/) change where they go.
- [Alerts](https://docs.subcloak.com/cloak-proxy/tools/alerts/) check them when they finish.
- In scripts, `context.clientApp` is `"Cloak Proxy (Repeat)"` or `"Cloak Proxy (Compose)"`, so a script can treat them differently.

This makes Compose a quick way to test a rule: send a request that should match and check the badge in the traffic list.

> **Note:**
> Repeated and composed requests are always recorded, even when the [Allow List](https://docs.subcloak.com/cloak-proxy/tools/allow-list/) is on. While recording is paused they aren't recorded at all, and Compose can't show the response.

> **Repeating has real effects:**
> Repeat sends the request to the real server again. Repeating a `POST` that places an order or sends a message does it a second time. Point it at a test server with [Map Remote](https://docs.subcloak.com/cloak-proxy/tools/map-remote/) or answer it with [Map Local](https://docs.subcloak.com/cloak-proxy/tools/map-local/) when that matters. Only send requests to systems you own or have permission to test.

## Repeat from the command line or an AI assistant

- [`cloakctl replay ID`](https://docs.subcloak.com/cloak-proxy/automation/cloakctl/) sends a captured request again.
- The [MCP server](https://docs.subcloak.com/cloak-proxy/automation/mcp-server/) has `replay_request` (send a captured request again, unchanged) and `edit_and_replay` (send a modified copy, or a new request).
- The MCP tool `repeat_request_many` is Repeat Advanced for an assistant: it takes the request's `id`, `count` (up to 1,000), `concurrency` (up to 50) and `delay_ms`, and returns the status counts, the min, average, p95 and max times, and the ids of the requests it sent. (added in Cloak Proxy 0.2.0)

## Compose or the API client?

Compose is for quick, one-off requests through the proxy. To save requests, organize them in collections, use variables and environments, or write tests, use the [API client](https://docs.subcloak.com/cloak-proxy/api-client/overview/) (<kbd>⇧</kbd> <kbd>⌘</kbd> <kbd>O</kbd>). You can send a captured request there with **Save to API Client** in the traffic list's right-click menu.

## Related

  - [Copy as code](https://docs.subcloak.com/cloak-proxy/inspect/copy-as-code/): Copy a captured request as cURL or code in many languages.
  - [API client](https://docs.subcloak.com/cloak-proxy/api-client/overview/): Collections, environments, tests and more.
  - [Breakpoint](https://docs.subcloak.com/cloak-proxy/tools/breakpoint/): Edit a live request instead of a repeated one.
  - [Authorization matrix](https://docs.subcloak.com/cloak-proxy/testing/authorization-matrix/): Replay every captured request as several users at once.
  - [Keyboard shortcuts](https://docs.subcloak.com/cloak-proxy/reference/keyboard-shortcuts/): Every shortcut in Cloak Proxy.
