JavaScript implementation of the HTTP preemptive content negotiation algorithm as defined in the original HTTP 1.1 draft spec. Stable version 1.0.1, no longer actively developed. Differentiators: implements the original draft negotiation algorithm (not the final RFC), handles media type, language, charset, and encoding negotiation. Suitable for Node.js HTTP servers needing automatic variant selection. Alternative to content-negotiation libraries that follow the final RFC.
npm install negotiateVerified import paths — ran on the pinned version, not inferred.
Shows how to define variants and select the best representation for an HTTP request using negotiate.choose().
Ensure your expected negotiation behavior matches the draft algorithm; test with various Accept headers.
Consider using an actively maintained alternative like 'content-negotiator' or implement RFC 7231 negotiation yourself.
Always explicitly set the quality property on each variant to control priority.
Add const Negotiate = require('negotiate'); or import Negotiate from 'negotiate'; at the top of your file.Run npm install negotiate --save to install the package.
Wrap your variant in an array: Negotiate.choose([variant], request);
No dependency data recorded yet.