Commit Graph

11 Commits

Author SHA1 Message Date
Jon Church
723b5451bb
Throw on invalid status codes (#4212)
* check status code is integer, or string integer, in range

* fix tests, update jsdoc comment for res.status

* throw if number is string

* narrow valid range to between 1xx and 5xx

* disambiguate the error message

* update skipped tests, remove invalid string test

* remove invalid float test

* fixup! remove invalid float test

* fix invalid range tests error assertions

* remove unused deprecate function

* add test to assert on 200.00 coming through as 200

this is the behavior of node's underlying HTTP module

* revert back to throwing only on > 999 and < 100

* update implementation for > 999

* add test for 700 status code

* update history with change

* update jsdoc

* clarify jsdoc comment

* one more round of jsdoc

* update 501 test

* add invalid status code test for res.sendStatus

* add test describe block for valid range

* fixup! add test describe block for valid range

* reduce the describe nesting

* switch to testing status 100, to avoid 100-continue behavior

* fix 900 test

* stringify code in thrown RangeError message

* remove accidentally duplicated res.status method

* fix error range message

Co-authored-by: Chris de Almeida <ctcpip@users.noreply.github.com>

* update sendStatus invalid code test to use sendStatus

---------

Co-authored-by: Chris de Almeida <ctcpip@users.noreply.github.com>
2024-07-30 14:49:13 -07:00
Wes Todd
416ba025a1 build: disable test for 4.x which is failing in v5 2024-03-20 21:52:27 -05:00
Jon Church
4847d0efa1 Deprecate string and non-integer arguments to res.status
closes #4223
2022-03-23 23:14:08 -04:00
Douglas Christopher Wilson
a65913776d tests: use strict mode 2022-02-09 01:07:08 -05:00
Douglas Christopher Wilson
0a48e18056 Revert "Improve error message for null/undefined to res.status"
fixes #3968
2019-05-25 18:15:13 -04:00
Joshua Caron
8da51108e7 Improve error message for null/undefined to res.status
closes #2795
closes #2797
closes #3111
2018-10-27 14:04:49 -04:00
Jonathan Ong
643397ed21 remove unnecessary test/support/http 2014-03-05 22:06:14 -08:00
TJ Holowaychuk
0f5560eebd updated tests to use "supertest" 2012-06-26 17:14:07 -07:00
Tj Holowaychuk
ed93e33d59 another test 2011-11-08 17:23:53 -08:00
Tj Holowaychuk
6e15b1cd20 Removed mock from res.status() test, mocks are lame 2011-11-08 17:23:14 -08:00
Tj Holowaychuk
cc2513facf res.status(code) test 2011-11-08 17:18:44 -08:00