From fabf5864c6a5dca0782b867a263b1b0825a05bf9 Mon Sep 17 00:00:00 2001 From: iamchenxin Date: Thu, 1 Dec 2016 04:16:02 -0600 Subject: [PATCH] Amend typo, request.is() return null|fasle|string. (#864) Modifying the test for `null` from `==` to `===` to make sure it must be `null`. --- docs/api/request.md | 2 +- test/request/is.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/api/request.md b/docs/api/request.md index a930bfb..4479800 100644 --- a/docs/api/request.md +++ b/docs/api/request.md @@ -195,7 +195,7 @@ ctx.body = yield db.find('something'); Check if the incoming request contains the "Content-Type" 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. Otherwise, it returns the matching content-type. diff --git a/test/request/is.js b/test/request/is.js index 76e917f..91a0cb1 100644 --- a/test/request/is.js +++ b/test/request/is.js @@ -17,9 +17,9 @@ describe('ctx.is(type)', () => { it('should return null', () => { const ctx = context(); - assert(null == ctx.is()); - assert(null == ctx.is('image/*')); - assert(null == ctx.is('image/*', 'text/*')); + assert(null === ctx.is()); + assert(null === ctx.is('image/*')); + assert(null === ctx.is('image/*', 'text/*')); }); });