Amend typo, request.is() return null|fasle|string. (#864)

Modifying the test for `null` from `==` to `===` to make sure it must be `null`.
This commit is contained in:
iamchenxin 2016-12-01 04:16:02 -06:00 committed by fengmk2
parent e3ccdac621
commit fabf5864c6
2 changed files with 4 additions and 4 deletions

View file

@ -195,7 +195,7 @@ ctx.body = yield db.find('something');
Check if the incoming request contains the "Content-Type" Check if the incoming request contains the "Content-Type"
header field, and it contains any of the give mime `type`s. header field, and it contains any of the give mime `type`s.
If there is no request body, `undefined` is returned. If there is no request body, `null` is returned.
If there is no content type, or the match fails `false` is returned. If there is no content type, or the match fails `false` is returned.
Otherwise, it returns the matching content-type. Otherwise, it returns the matching content-type.

View file

@ -17,9 +17,9 @@ describe('ctx.is(type)', () => {
it('should return null', () => { it('should return null', () => {
const ctx = context(); const ctx = context();
assert(null == ctx.is()); assert(null === ctx.is());
assert(null == ctx.is('image/*')); assert(null === ctx.is('image/*'));
assert(null == ctx.is('image/*', 'text/*')); assert(null === ctx.is('image/*', 'text/*'));
}); });
}); });