Fix typo for accepts(). (#863)

it return {String|Array|false}, never return undeifined.
master
iamchenxin 2016-12-06 10:22:11 -06:00 committed by Yiyu He
parent fabf5864c6
commit 2db3b1b49a
2 changed files with 4 additions and 3 deletions

View File

@ -415,7 +415,7 @@ module.exports = {
/**
* Check if the given `type(s)` is acceptable, returning
* the best match when true, otherwise `undefined`, in which
* the best match when true, otherwise `false`, in which
* case you should respond with 406 "Not Acceptable".
*
* The `type` value may be a single mime type string
@ -442,7 +442,7 @@ module.exports = {
* // Accept: text/*, application/json
* this.accepts('image/png');
* this.accepts('png');
* // => undefined
* // => false
*
* // Accept: text/*;q=.5, application/json
* this.accepts(['html', 'json']);
@ -450,7 +450,7 @@ module.exports = {
* // => "json"
*
* @param {String|Array} type(s)...
* @return {String|Array|Boolean}
* @return {String|Array|false}
* @api public
*/

View File

@ -87,6 +87,7 @@ describe('ctx.accepts(types)', () => {
ctx.accepts('text/html').should.equal('text/html');
ctx.accepts('text/plain').should.equal('text/plain');
ctx.accepts('image/png').should.be.false;
ctx.accepts('png').should.be.false;
});
});
});