Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
@fastify/accept-negotiator
Advanced tools
A negotiator for the accept-headers
npm i @fastify/accept-negotiator
The module exports a function that you can use for negotiating an accept-header, e.g. accept-encoding. It takes 2 parameters:
negotiate(header, supportedValues)
header
(string
, required) - The accept-header, e.g. accept-encodingsupportedValues
(string[]
, required) - The values, which are supportedconst negotiate = require('@fastify/accept-negotiator').negotiate
const encoding = negotiate('gzip, deflate, br', ['br'])
console.log(encoding) // 'br*
The module also exports a class that you can use for negotiating an accept-header, e.g. accept-encoding, and use caching for better performance.
Negotiate(supportedValues)
supportedValues
(string[]
, required) - The values, which are supportedcache
({ set: Function; get: Function; has: Function }
, optional) - A Cache-Store, e.g. ES6-Map or mnemonist LRUCacheconst Negotiator = require('@fastify/accept-negotiator').Negotiator
const encodingNegotiator = new Negotiator({ supportedValues: ['br'], cache: new Map() })
const encoding = encodingNegotiator.negotiate('gzip, deflate, br')
console.log(encoding) // 'br*
Licensed under MIT.
FAQs
a negotiator for the accept-headers
The npm package @fastify/accept-negotiator receives a total of 744,143 weekly downloads. As such, @fastify/accept-negotiator popularity was classified as popular.
We found that @fastify/accept-negotiator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 17 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.