Skip to content

Commit

Permalink
Revert "Improve error message for null/undefined to res.status"
Browse files Browse the repository at this point in the history
fixes #3968
  • Loading branch information
dougwilson committed May 25, 2019
1 parent eed05a1 commit 0a48e18
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 36 deletions.
5 changes: 5 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
unreleased
==========

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

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

Expand Down
4 changes: 0 additions & 4 deletions lib/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
32 changes: 0 additions & 32 deletions test/res.status.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.