Back to Explore

jshttp/negotiator

GitHub
1 watchersOpen source

Last release: 10/19/2024

An HTTP content negotiator for Node.js that parses client headers like Accept, Accept-Language, Accept-Charset, and Accept-Encoding to rank and select the most preferred media types, languages, charsets, and encodings. Useful for choosing what content format to respond with based on a request’s preference headers.

Project status

  • Maintenance status: The repo shows a recent upstream push (2026-05-01), but the latest update/tag information provided here stops at v1.0.0 (2024-10-19), so active maintenance is plausible but cadence in this dataset appears limited.
  • Update cadence: Known update points are sparse (0.6.3 in 2022, then 0.6.4 and 1.0.0 in 2024), suggesting long intervals between published updates, though there may be untagged work given the 2026 push timestamp.

AI summary generated Today

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

Recent updates

  • v0.6.4

    10/19/2024

    v0.6.4 release notes state two user-visible changes, adding a preferred encodings option and replacing deprecated String.prototype.substr usage. However, the provided code diff shows only a version bump in package.json and no actual source changes.

    Features
  • v1.0.0

    10/19/2024

    This release is version 1.0.0 and primarily introduces support for developer-preferred encoding ordering, controlled via a new `preferred` array option. It also drops support for Node versions below 18 and modernizes CI/test Node targets.

    BreakingFeatures
  • 0.6.3

    1/27/2022

    Version 0.6.3 reverts a previous change related to lazy-loading internal charset, encoding, language, and media type modules. The primary code change is in `index.js`, where negotiator now requires these modules at startup instead of loading them on demand.

    Breaking
  • 0.6.2

    4/30/2019

    Release 0.6.2 updates the library to correctly handle Accept parameters for charsets, encodings, and languages so results are sorted as expected even when extra parameters are present. The code changes primarily adjust how parsing loops handle parameter lists, and the release also updates development tooling and test infrastructure.

  • 0.6.1

    5/3/2016

    Release 0.6.1 is presented as a pure performance update, claiming faster parsing for the Accept family of HTTP headers: Accept, Accept-Charset, Accept-Encoding, and Accept-Language. The code changes are small but they do modify the underlying token matching regular expressions used by the header parsers.

  • 0.6.0

    9/30/2015

    Version 0.6.0 focuses on correcting Accept header parameter parsing edge cases (especially around quoted values) and improving runtime performance. It also introduces lazy-loading and stricter code (use strict) to reduce startup work and allocation overhead.

  • 0.5.3

    9/30/2015

    Version 0.5.3 updates media type parameter matching so parameter names are treated case-insensitively. The change is implemented in media type parsing and is covered by new unit tests.

  • 0.5.2

    5/7/2015

    Release 0.5.2 focuses on fixing HTTP Accept header parsing for media types when parameter values are quoted and when quoted commas appear inside those values. The runtime change is in media type parsing, improving how the library splits and interprets media type parameters.

  • 0.5.1

    2/15/2015

    This release (0.5.1) focuses on fixing how negotiator results are sorted when the client sends long Accept headers. The code changes adjust the internal tie-breaking logic so the output ordering is stable. Documentation and tests were updated to reflect and validate the behavior.

  • 0.5.0

    2/15/2015

    Release 0.5.0 focuses on fixing HTTP content negotiation edge cases, specifically ordering issues for large Accept-Language/MediaType/etc lists and a bug where identity encoding handling could fail when q=0 was present. It also removes the dynamic construction of the Negotiator prototype, replacing it with explicit method definitions.