negotiator
Last updated
Last updated
An HTTP content negotiator for Node.js
You can check a working example at examples/accept.js
.
mediaType()
Returns the most preferred media type from the client.
mediaType(availableMediaType)
Returns the most preferred media type from a list of available media types.
mediaTypes()
Returns an array of preferred media types ordered by the client preference.
mediaTypes(availableMediaTypes)
Returns an array of preferred media types ordered by priority from a list of available media types.
You can check a working example at examples/language.js
.
language()
Returns the most preferred language from the client.
language(availableLanguages)
Returns the most preferred language from a list of available languages.
languages()
Returns an array of preferred languages ordered by the client preference.
languages(availableLanguages)
Returns an array of preferred languages ordered by priority from a list of available languages.
You can check a working example at examples/charset.js
.
charset()
Returns the most preferred charset from the client.
charset(availableCharsets)
Returns the most preferred charset from a list of available charsets.
charsets()
Returns an array of preferred charsets ordered by the client preference.
charsets(availableCharsets)
Returns an array of preferred charsets ordered by priority from a list of available charsets.
You can check a working example at examples/encoding.js
.
encoding()
Returns the most preferred encoding from the client.
encoding(availableEncodings)
Returns the most preferred encoding from a list of available encodings.
encodings()
Returns an array of preferred encodings ordered by the client preference.
encodings(availableEncodings)
Returns an array of preferred encodings ordered by priority from a list of available encodings.
The accepts module builds on this module and provides an alternative interface, mime type validation, and more.