http-header-list
v1.0.0
Published
Parser and logic functions for HTTP header lists
Downloads
37
Readme
http-header-list 1.0.0
Parser and logic functions for HTTP header lists
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!