Skip to content
Myr

Added req.acceptsLanguage()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parent 5e071a2 · Browse files · 1 file+16 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+16 added−0 removed

  • other:+16 added−0 removed

1 file+16 added−0 removed

modified:lib/request.js+16 added
142 unmodified lines
143 : true;144};145146/**147 * Check if the given `lang` is acceptable,148 * otherwise you should respond with 406 "Not Acceptable".149 *150 * @param {String} lang151 * @return {Boolean}152 * @api public153 */154155req.acceptsLanguage = function(lang){156 var accepted = this.acceptedLanguages;157 return accepted.length158 ? ~accepted.indexOf(lang)159 : true;160};161162/**163 * Return an array of Accepted media types164 * ordered from highest quality to lowest.165 *166 * Examples:
299 unmodified lines