Skip to content
Allure report logoAllure Report
Main Navigation ModulesDocumentationStarter Project

English

Español

English

Español

Appearance

Sidebar Navigation

Allure 3

Install & Upgrade

Install Allure

Upgrade Allure

Configure

Create Reports

How to generate a report

How to view a report

Improving readability of your test reports

Improving navigation in your test report

Reading Allure charts

Migrate from Allure 2

Allure 2

Install & Upgrade

Install for Windows

Install for macOS

Install for Linux

Install for Node.js

Upgrade Allure

Create Reports

How to generate a report

How to view a report

Improving readability of your test reports

Improving navigation in your test report

Features

Test steps

Attachments

Test statuses

Assertion diffs

Sorting and filtering

Environments

Multistage Builds

Categories

Visual analytics

Test stability analysis

History and retries

Quality Gate

Global Errors and Attachments

Timeline

Export to CSV

Export metrics

Guides

JUnit 5 parametrization

JUnit 5 & Selenide: screenshots and attachments

JUnit 5 & Selenium: screenshots and attachments

Setting up JUnit 5 with GitHub Actions

Pytest parameterization

Pytest & Selenium: screenshots and attachments

Pytest & Playwright: screenshots and attachments

Pytest & Playwright: videos

Playwright parameterization

Publishing Reports to GitHub Pages

Allure Report 3: XCResults Reader

How it works

Overview

Glossary

Test result file

Container file

Categories file

Environment file

Executor file

History files

Test Identifiers

Integrations

Azure DevOps

Bamboo

GitHub Action

Jenkins

JetBrains IDEs

TeamCity

Visual Studio Code

Frameworks

Axios

Getting started

Configuration

Reference

Behat

Getting started

Configuration

Reference

Behave

Getting started

Configuration

Reference

Bun

Getting started

Configuration

Reference

Chai

Getting started

Reference

Codeception

Getting started

Configuration

Reference

CodeceptJS

Getting started

Configuration

Reference

Cucumber.js

Getting started

Configuration

Reference

Cucumber-JVM

Getting started

Configuration

Reference

Cucumber.rb

Getting started

Configuration

Reference

Cypress

Getting started

Configuration

Reference

Fetch

Getting started

Configuration

Reference

Jasmine

Getting started

Configuration

Reference

JBehave

Getting started

Configuration

Reference

Jest

Getting started

Configuration

Reference

JUnit 4

Getting started

Configuration

Reference

JUnit 5

Getting started

Configuration

Reference

Mocha

Getting started

Configuration

Reference

Newman

Getting started

Configuration

Reference

NUnit

Getting started

Configuration

Reference

PHPUnit

Getting started

Configuration

Reference

Playwright

Getting started

Configuration

Reference

pytest

Getting started

Configuration

Reference

Pytest-BDD

Getting started

Configuration

Reference

Reqnroll

Getting started

Configuration

Reference

REST Assured

Getting started

Configuration

Robot Framework

Getting started

Configuration

Reference

Rust Cargo Test

Getting started

Configuration

Reference

RSpec

Getting started

Configuration

Reference

SpecFlow

Getting started

Configuration

Reference

Spock

Getting started

Configuration

Reference

TestNG

Getting started

Configuration

Reference

Vitest

Getting started

Configuration

Reference

WebdriverIO

Getting started

Configuration

Reference

xUnit.net

Getting started

Configuration

Reference

On this page

Getting started with Allure Fetch ​

Allure Fetch npm latest version

Capture fetch HTTP requests and responses as attachments in your Allure Report test reports.

Allure Fetch is compatible with any Allure JS framework integration, including Allure Vitest, Allure Jest, Allure Playwright, Allure Mocha, and others.

To enable the integration in your project:

  1. Make sure you have an Allure integration set up for the test framework you use.

    See the instructions in the integration's documentation in Frameworks.

  2. Install allure-fetch.

    bash
    npm install --save-dev allure-fetch
    bash
    yarn add --dev allure-fetch
    bash
    pnpm install --dev allure-fetch
  3. Wrap your fetch implementation with withAllure() to start capturing requests.

    The example below shows usage in a Vitest test suite.

    ts
    import { withAllure } from "allure-fetch";
    import { describe, expect, it } from "vitest";
    
    const client = withAllure(fetch);
    
    describe("Orders API", () => {
      it("creates an order", async () => {
        const response = await client("https://api.example.com/orders", {
          method: "POST",
          headers: { "content-type": "application/json" },
          body: JSON.stringify({ item: "book", qty: 1 }),
        });
        expect(response.status).toBe(201);
      });
    });

    Every HTTP request made through client will be added to the test result as an attachment, wrapped in a step of the same name. The attachment captures the full exchange in one place: the request method, URL, headers, query parameters, cookies, and body; the response status, headers, cookies (including attributes such as Path, Domain, Expires, Secure, HttpOnly, and SameSite), and body; the exchange start and stop timestamps; and, when the request fails, the error name and message.

    If your tests call the global fetch directly, use instrumentGlobalFetch() instead. It replaces globalThis.fetch with an instrumented version and returns a restore function. Call the restore function when you no longer want requests captured — typically in afterEach or afterAll:

    ts
    import { instrumentGlobalFetch } from "allure-fetch";
    import { afterEach, beforeEach, describe, expect, it } from "vitest";
    
    describe("Orders API", () => {
      let restore: () => void;
    
      beforeEach(() => {
        restore = instrumentGlobalFetch();
      });
    
      afterEach(() => {
        restore();
      });
    
      it("creates an order", async () => {
        const response = await fetch("https://api.example.com/orders", {
          method: "POST",
          headers: { "content-type": "application/json" },
          body: JSON.stringify({ item: "book", qty: 1 }),
        });
        expect(response.status).toBe(201);
      });
    });

    INFO

    To prevent secrets from leaking into reports, certain values are redacted by default — all cookies, any header or query parameter whose name suggests it contains a credential, and any URL-encoded form field whose name does the same. See Allure Fetch configuration for the full list of defaults and how to customize the redaction rules.

  4. Run your tests and generate a test report the same way as you would normally.

Pager
Previous pageReference
Next pageConfiguration
Powered by

Subscribe to our newsletter

Get product news you actually need, no spam.

Subscribe
Allure TestOps
  • Overview
  • Why choose us
  • Cloud
  • Self-hosted
  • Success Stories
Company
  • Documentation
  • Blog
  • About us
  • Contact
  • Events
© 2026 Qameta Software Inc. All rights reserved.
A Markdown version of this page is available at /docs/fetch.md