http-header-list
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

http-header-list 1.0.0

Parser and logic functions for HTTP header lists

pipeline status http-header-list on NPM license developtment time contributor covenant support development

A dependency-free module to parse HTTP headers like Accept logic functions to run common checks like finding the first matching value.

Example

/* eslint-disable no-console */
import { HeaderList } from 'http-header-list';

const acceptList = new HeaderList(
  'text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8'
);

const type = acceptList.firstMatch(['application/xml', 'application/xhtml+xml']);

console.log(type);

/* Output will be:
 * { value: 'application/xhtml+xml', weight: 1, parameters: {} }
 */

Development

Feel free to post errors or feature requests to the project issue tracker or email them to us. Please submit security concerns as a confidential issue

The source is hosted on Gitlab and uses eslint, prettier, lint-staged and husky to keep things pretty. As such, when you first clone the repository, as well as installing the npm dependencies, you will also need to install husky.

# Install NPM dependencies
npm install
# Set up husky Git hooks stored in .husky
npx husky install

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

1.0.0 - 2022-07-27

Initial version!

Package Sidebar

Install

npm i http-header-list

Weekly Downloads

2

Version

1.0.0

License

AGPL-3.0

Unpacked Size

52.2 kB

Total Files

18

Last publish

Collaborators

  • bytesnz