---
title: Reqwest reference
description: Reference documentation for Allure Reqwest | HttpExchange attachment schema | AllureReqwestClient | AllureReqwestMiddleware
---

# Allure Reqwest reference

## Attachment schema

Each HTTP exchange is recorded as an [HTTP exchange attachment](/docs/attachments/#http-exchanges)
with content type `application/vnd.allure.http+json` and file extension `.httpexchange`. The
schema is shared across Allure's HTTP-capturing integrations
(`allure_rust_commons::HttpExchange`); the tables below list every field the shared type supports,
and note which ones `allure-reqwest` actually populates — several exist only for other,
richer integrations and are always absent from a reqwest-captured exchange.

The root object:

| Field           | Type     | Populated by `allure-reqwest`?                                                   |
| --------------- | -------- | -------------------------------------------------------------------------------- |
| `schemaVersion` | `1`      | Always `1`.                                                                      |
| `start`         | `number` | Always — Unix timestamp in milliseconds when the request started.                |
| `stop`          | `number` | Always — Unix timestamp in milliseconds when the response or error was received. |
| `request`       | object   | Always. See [Request](#request).                                                 |
| `response`      | object   | Present when a response was received. See [Response](#response).                 |
| `error`         | object   | Present when the request failed. See [Error](#error).                            |

Unlike some other Allure HTTP integrations, a non-2xx/3xx HTTP status is **not** an error by
itself: reqwest doesn't treat 4xx/5xx as a failure, so `allure-reqwest` doesn't either — you get a
normal `response` with no `error`. `error` is only present for transport failures (connection
errors, timeouts) or a failure while reading the response body.

### Request

| Field         | Type              | Populated by `allure-reqwest`?                                                                                          |
| ------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `method`      | `string`          | Always — HTTP method, e.g. `"POST"`.                                                                                    |
| `url`         | `string`          | Always — the resolved request URL, including query parameters in unredacted form.                                       |
| `httpVersion` | `string`          | Always — e.g. `"HTTP/1.1"`.                                                                                             |
| `headers`     | `{name, value}[]` | Present when the request has headers, after redaction.                                                                  |
| `query`       | `{name, value}[]` | Present when the URL has query parameters, after redaction.                                                             |
| `body`        | object            | Present when request body capture is enabled (default) and the body is available as in-memory bytes. See [Body](#body). |
| `cookies`     | `Cookie[]`        | Never — `allure-reqwest` does not parse the `Cookie` header into structured cookies.                                    |
| `trailers`    | `{name, value}[]` | Never.                                                                                                                  |

Warning:
A request body built from a stream (anything where `reqwest::Body::as_bytes()` returns `None` —
for example a body constructed from a `futures::Stream`) is silently **not** captured: `body` is
simply absent from the attachment, with no placeholder and no indication that a body existed.
Only in-memory bodies (`&str`, `String`, `Vec<u8>`, `Bytes`, forms, and similar) are captured.

### Response

| Field                    | Type              | Populated by `allure-reqwest`?                                                                                                                                                                |
| ------------------------ | ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `status`                 | `number`          | Always.                                                                                                                                                                                       |
| `statusText`             | `string`          | Always, when the status has a canonical reason phrase (e.g. `"Created"` for 201).                                                                                                             |
| `httpVersion`            | `string`          | Always.                                                                                                                                                                                       |
| `headers`                | `{name, value}[]` | Present when the response has headers, after redaction.                                                                                                                                       |
| `body`                   | object            | Present only when response body capture is explicitly enabled (see [Configuration](/docs/reqwest-configuration/#control-body-capture)) and the body was read successfully. See [Body](#body). |
| `cookies`                | `Cookie[]`        | Never.                                                                                                                                                                                        |
| `trailers`               | `{name, value}[]` | Never.                                                                                                                                                                                        |
| `informationalResponses` | object[]          | Never.                                                                                                                                                                                        |

### Body

| Field         | Type                 | Populated by `allure-reqwest`?                                                                                                                   |
| ------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `contentType` | `string`             | Present when a `Content-Type` header is present on that side of the exchange.                                                                    |
| `encoding`    | `"utf8" \| "base64"` | Always present alongside `value`: `"utf8"` when the captured bytes are valid UTF-8, `"base64"` otherwise.                                        |
| `value`       | `string`             | Always present alongside `encoding` — the captured bytes, up to the size limit.                                                                  |
| `size`        | `number`             | Always — the **original, untruncated** byte length, even when `value` was cut short.                                                             |
| `truncated`   | `boolean`            | Always — `true` when the original body was larger than the configured limit.                                                                     |
| `form`        | `{name, value}[]`    | Never — `allure-reqwest` does not parse `application/x-www-form-urlencoded` bodies into fields; they're only captured as the raw `value` string. |
| `parts`       | object[]             | Never — multipart bodies are captured as a single raw `value`, not broken into parts.                                                            |
| `stream`      | object               | Never — see the warning above; a streamed body has no `body` field at all, not a `stream` placeholder.                                           |

### Error

| Field     | Type     | Populated by `allure-reqwest`?                                                                                      |
| --------- | -------- | ------------------------------------------------------------------------------------------------------------------- |
| `name`    | `string` | Always — `"reqwest::Error"` for `AllureReqwestClient`, `"reqwest_middleware::Error"` for `AllureReqwestMiddleware`. |
| `message` | `string` | Always — the error's `Display` output.                                                                              |
| `stack`   | `string` | Never — there is no option to capture one.                                                                          |

## `AllureReqwestClient`

- `AllureReqwestClient::new(allure: AllureFacade)` — wraps a new `reqwest::Client`
- `AllureReqwestClient::with_client(client: reqwest::Client, allure: AllureFacade)` — wraps an existing client
- `.with_options(options: CaptureOptions)` — see [Configuration](/docs/reqwest-configuration/)
- `.inner() -> &reqwest::Client` — the wrapped client
- `.request(method, url)`, `.get(url)`, `.post(url)`, `.put(url)`, `.patch(url)`, `.delete(url)`, `.head(url)` — return a plain `reqwest::RequestBuilder`, same as `reqwest::Client`
- `.send(builder: RequestBuilder) -> reqwest::Result<Response>` — builds and executes the request builder while capturing the exchange
- `.execute(request: Request) -> reqwest::Result<Response>` — executes an already-built `Request` while capturing the exchange

Only requests sent through `.send()`/`.execute()` are captured. Building a request with `.get()`/
`.post()`/etc. and sending it through the plain `reqwest::RequestBuilder` API instead (bypassing
`.send()`) is not captured.

## `AllureReqwestMiddleware`

Requires the `middleware` feature.

- `AllureReqwestMiddleware::new(allure: AllureFacade)`
- `.with_options(options: CaptureOptions)` — see [Configuration](/docs/reqwest-configuration/)

Implements `reqwest_middleware::Middleware`; attach it with
`ClientBuilder::new(reqwest::Client::new()).with(middleware).build()`. Every request made through
the resulting `ClientWithMiddleware` is captured — no per-call changes needed.
