Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

parse-prefer-header

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-prefer-header

parses an http prefer header, aka rfc7240

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
95K
increased by10.57%
Maintainers
1
Weekly downloads
 
Created
Source

node-parse-prefer-header

Parses an HTTP Prefer header, aka RFC7240.

const parsePreferHeader = require('parse-prefer-header');

const preferences = parsePreferHeader('respond-async, wait=300');
// preferences = { respondAsync: true, wait: '300' }

Installation

$ npm install parse-prefer-header

Features

  • Parses the HTTP Prefer header into a friendly JavaScript object
  • Normalizes tokens into JavaScript properties (e.g. respondAsync)
  • Handles quoting correctly (e.g. foo=";= ,;=" becomes { foo: ';= ,;='})
  • Supports token parameters

API

parsePreferHeader(preferHeader: string | string[]): { [key: string]: string | boolean }

Parses the Prefer header value, or an Array of such values, and returns an object mapping each preference token to its value or true.

See here for an explanation of the initial set of preferences.

Keywords

FAQs

Package last updated on 26 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc