Skip to content
Myr

docs

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 4e2677f · Browse files · 1 file+16 added−14 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−14 removed

  • other:+16 added−14 removed

1 file+16 added−14 removed

modified:lib/request.js+16 added-14 removed
60 unmodified lines
61 * Check if the given `type(s)` is acceptable, returning62 * the best match when true, otherwise `undefined`, in which63 * case you should respond with 406 "Not Acceptable".64 *65 * The `type` value may be a single mime type string66 * such as "application/json", the extension name67 * such as "json", a comma-delimted list such as "json, html, text/plain",68 * or an array `["json", "html", "text/plain"]`. When a list69 * or array is given the _best_ match, if any is returned.70 *71 * Examples:72 * 73 * // Accept: text/html74 * req.accepts('html');69 * // => true75 * // => "html"76 *77 * // Accept: text/*; application/json78 * req.accepts('html');79 * // => "html"80 * req.accepts('text/html');81 * // => "text/html"74 * req.accepts('text/plain');82 * req.accepts('json, text');83 * // => "json"84 * req.accepts('application/json');76 * // => true85 * // => "application/json"86 *87 * // Accept: text/*; application/json88 * req.accepts('image/png');89 * req.accepts('png');81 * // => false90 * // => undefined91 *83 * // Accept: text/*; application/json92 * // Accept: text/*;q=.5 application/json93 * req.accepts(['html', 'json']);94 * req.accepts('html, json');85 * // => "html"95 * // => "json"96 *87 * // Accept: text/*; q=.5, application/json88 * req.accepts(['text/html', 'application/json']);89 * // => "application/json"90 *91 * // Accept: text/plain92 * req.accepts(['text/html', 'application/json']);93 * // => undefined94 *97 * @param {String|Array} type(s)98 * @return {String}99 * @api public100 */
294 unmodified lines