Back to Explore

mswjs/headers-polyfill

GitHub
1 watchersOpen source

Last release: 3 months ago

A Fetch API Headers polyfill and transformation library that provides a `Headers` class for constructing and managing HTTP headers in non-browser environments. It also includes helpers to convert headers between `Headers`, strings, lists, and plain objects, preserving raw header names when needed.

Project status

  • Actively maintained: Recent activity is evident, with the latest upstream push on 2026-06-01, and updates released as recently as 2026-03-05.
  • Update cadence: There is a long gap before the v4.0.3 (2024-03-18) to the v5.0.0 (2026-03-05) jump, but within that, v5.0.0 and v5.0.1 land on the same date, suggesting rapid follow-up for a targeted fix.

AI summary generated Today

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v5.0.1

    3 months ago

    v5.0.1 is a small bug fix release for the headers-polyfill. It ensures the Headers constructor can accept a HeadersInit object created with a null prototype (Object.create(null)) without throwing.

  • v5.0.0

    3 months ago

    v5.0.0 modernizes the package build and test toolchain and introduces iterator disposal support intended to work with TypeScript 5.2. It also updates published entrypoints toward an ESM-first layout using conditional `exports`. Release notes call out esm-first and a TypeScript 5.2 disposable-method fix, but the diff shows additional packaging and compatibility changes that are not fully documented.

    BreakingFeatures
  • v4.0.3

    3/18/2024

    Release v4.0.3 primarily adds a [Symbol.toStringTag] property to the Headers polyfill so that Object.prototype.toString output matches what developers expect. The release notes only mention this change, and the code diff confirms it, with additional test and CI workflow adjustments.

  • v4.0.2

    10/18/2023

    Release v4.0.2 is presented as a single bug fix related to interoperability with Undici 5.26.3. The code diff shows a change to how the Headers polyfill constructor detects “native” Headers-like inputs, plus CI and release workflow changes not mentioned in the release notes.

  • v4.0.1

    9/13/2023

    v4.0.1 is labeled as a bug fix release, and the provided release notes only mention updating documentation around the getRawHeaders method. The actual diff shown modifies README.md and bumps the package version in package.json, with no library code changes visible in the diff.

  • v4.0.0

    9/13/2023

    The v4.0.0 release notes are effectively empty (only reference issue #70). The actual code diff shows no functional source changes, only a package.json version bump and a minor formatting change (newline at end of file).

  • v3.3.0

    9/13/2023

    v3.3.0 removes the Headers instance method .all() and replaces the .raw() method with a standalone getRawHeaders(headers) helper. The main public change is around how callers retrieve normalized vs raw header names, plus related refactoring in exports.

    BreakingFeatures
  • v3.2.5

    9/13/2023

    v3.2.5 adds validation for HTTP header names and header values. The implementation introduces new utility validators and updates `Headers` methods (`has`, `get`, `set`, `append`, `delete`) to reject invalid inputs.

  • v3.2.4

    9/13/2023

    v3.2.4 updates the Headers polyfill iteration order for `.keys()`, `.values()`, and `.entries()` to return results sorted alphabetically. The implementation also changes how `set-cookie` headers are iterated, and that behavior flows through other iteration-based APIs like `forEach().`

  • v3.2.3

    9/7/2023

    Release v3.2.3 updates the build output to target ES5, aligning with the stated goal of transpiling away from ES2020. The code diff also shows a build toolchain change by adding @swc/core to the devDependencies, which is not mentioned in the release notes.