Skip to content
Myr

add deprecation message to non-plural req.accepts*

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

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent 83bbf09 · Browse files · 7 files+159 added−17 removed
This commit

State

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

Diff stats

7 files+159 added−17 removed

  • tests:+142 added−4 removed
  • other:+17 added−13 removed

7 files+159 added−17 removed

modified:lib/request.js+16 added-13 removed
1 unmodified line
2 * Module dependencies.3 */45var accepts = require('accepts');6var deprecate = require('depd')('express');7var typeis = require('type-is');8var http = require('http');9var fresh = require('fresh');10var parseRange = require('range-parser');
95 unmodified lines
106 return accept.types.apply(accept, arguments);107};108109/**109 * Check if the given `encoding` is accepted.110 * Check if the given `encoding`s are accepted.111 *111 * @param {String} encoding112 * @param {String} ...encoding113 * @return {Boolean}114 * @api public115 */116116req.acceptsEncoding = // backwards compatibility117req.acceptsEncodings = function(){118 var accept = accepts(this);119 return accept.encodings.apply(accept, arguments);120};121122req.acceptsEncoding = deprecate.function(req.acceptsEncodings,123 'req.acceptsEncoding: Use acceptsEncodings instead');124125/**123 * To do: update docs.124 *125 * Check if the given `charset` is acceptable,126 * Check if the given `charset`s are acceptable,127 * otherwise you should respond with 406 "Not Acceptable".128 *128 * @param {String} charset129 * @param {String} ...charset130 * @return {Boolean}131 * @api public132 */133133req.acceptsCharset = // backwards compatibility134req.acceptsCharsets = function(){135 var accept = accepts(this);136 return accept.charsets.apply(accept, arguments);137};138139req.acceptsCharset = deprecate.function(req.acceptsCharsets,140 'req.acceptsCharset: Use acceptsCharsets instead');141142/**140 * To do: update docs.141 *142 * Check if the given `lang` is acceptable,143 * Check if the given `lang`s are acceptable,144 * otherwise you should respond with 406 "Not Acceptable".145 *145 * @param {String} lang146 * @param {String} ...lang147 * @return {Boolean}148 * @api public149 */150150req.acceptsLanguage = // backwards compatibility151req.acceptsLanguages = function(){152 var accept = accepts(this);153 return accept.languages.apply(accept, arguments);154};155156req.acceptsLanguage = deprecate.function(req.acceptsLanguages,157 'req.acceptsLanguage: Use acceptsLanguages instead');158159/**160 * Parse Range header field,161 * capping to the given `size`.162 *
283 unmodified lines
modified:test/req.acceptsCharset.js+3 added-3 removed
added:test/req.acceptsCharsets.js+49 added
modified:test/req.acceptsEncoding.js+1 added-1 removed
added:test/req.acceptsEncodings.js+36 added
added:test/req.acceptsLanguages.js+53 added
modified:History.md+1 added
1unreleased2==========34 * add deprecation message to non-plural `req.accepts*`5 * deprecate things with `depd` module6 * fix behavior when handling request without routes7 * fix handling when `route.all` is only route8 * restore `req.params` after invoking router
1683 unmodified lines