Skip to content
Permalink
Browse files

Revert "Improve error message for null/undefined to res.status"

fixes #3968
  • Loading branch information...
dougwilson committed May 25, 2019
1 parent eed05a1 commit 0a48e18056865364b2461b2ece7ccb2d1075d3c9
Showing with 5 additions and 36 deletions.
  1. +5 −0 History.md
  2. +0 −4 lib/response.js
  3. +0 −32 test/res.status.js
@@ -1,3 +1,8 @@
unreleased
==========

* Revert "Improve error message for `null`/`undefined` to `res.status`"

4.17.0 / 2019-05-16
===================

@@ -64,10 +64,6 @@ var charsetRegExp = /;\s*charset\s*=/;
*/

res.status = function status(code) {
if (code === undefined || code === null) {
throw new TypeError('code argument is required to res.status')
}

this.statusCode = code;
return this;
};
@@ -16,37 +16,5 @@ describe('res', function(){
.expect('Created')
.expect(201, done);
})

describe('when code is undefined', function () {
it('should throw a TypeError', function (done) {
var app = express()

app.use(function (req, res) {
res.status(undefined).send('OK')
})

request(app)
.get('/')
.expect(500)
.expect(/TypeError: code argument is required to res.status/)
.end(done)
})
})

describe('when code is null', function () {
it('should throw a TypeError', function (done) {
var app = express()

app.use(function (req, res) {
res.status(null).send('OK')
})

request(app)
.get('/')
.expect(500)
.expect(/TypeError: code argument is required to res.status/)
.end(done)
})
})
})
})

0 comments on commit 0a48e18

Please sign in to comment.
You can’t perform that action at this time.