Commit Graph

1202 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
ee40a881f5 call callback once on listen error 2024-05-17 13:47:56 -07:00
Evan Hahn
14439731f9 Use object with null prototype for various app properties
`app.cache`, `app.engines`, and `app.settings` are now created with
`Object.create(null)` instead of `{}`.

This also updates a test to ensure that `app.locals` is created the same
way.
2024-04-29 09:43:25 -05:00
Wes Todd
6415f7035b Merge tag '4.19.2' into 5.0
4.19.2
2024-03-25 09:37:02 -05:00
Wes Todd
da4d763ff6 Improved fix for open redirect allow list bypass
Co-authored-by: Jon Church <me@jonchurch.com>
Co-authored-by: Blake Embrey <hello@blakeembrey.com>
2024-03-25 09:22:34 -05:00
Wes Todd
416ba025a1 build: disable test for 4.x which is failing in v5 2024-03-20 21:52:27 -05:00
Wes Todd
60fb1d2acd Merge tag '4.19.1' into 5.x
4.19.1
2024-03-20 21:17:26 -05:00
Wes Todd
e9f9aaeebd Merge tag '4.19.0' into 5.x
4.19.0
2024-03-20 21:14:00 -05:00
Wes Todd
a003cfab03 Allow passing non-strings to res.location with new encoding handling checks fixes #5554 #5555 2024-03-20 17:12:46 -05:00
Wes Todd
11f2b1db22 build: fix build due to inconsistent supertest behavior in older versions 2024-03-20 16:33:03 -05:00
FDrag0n
0867302ddb Prevent open redirect allow list bypass due to encodeurl
Co-authored-by: Jon Church <me@jonchurch.com>
2024-03-20 10:18:54 -05:00
Rich Hodgkins
69a4cf2819 deps: cookie@0.6.0
closes #5404
2024-03-15 10:27:45 -05:00
christof louw
2a89eb5c74 tests: fix handling multiple callbacks
closes #5233
2024-02-19 08:20:39 -05:00
Raz Luvaton
2a00da2067 tests: use random port in listen test
closes #5162
2023-06-04 11:47:20 -04:00
Rakesh Bisht
3531987844 lint: remove unused function arguments in Route tests
closes #5137
2023-05-15 21:53:48 -04:00
Douglas Christopher Wilson
8c24fa8f7b tests: wait for server close in app.listen() 2023-03-13 22:43:19 -04:00
Douglas Christopher Wilson
74beeac071 Fix routing requests without method 2023-02-23 17:23:22 -05:00
Douglas Christopher Wilson
1e42a98db6 deps: body-parser@1.20.2 2023-02-23 00:24:20 -05:00
Rakesh Bisht
c6ee8d6e7f lint: remove unused function arguments in tests
closes #5124
2023-02-20 22:57:13 -05:00
Douglas Christopher Wilson
bb7907b932 build: Node.js@18.10
closes #5014
2022-10-07 17:48:59 -04:00
Douglas Christopher Wilson
97f0a518d8 tests: verify all handlers called in stack tests 2022-05-20 11:54:35 -04:00
Douglas Christopher Wilson
7ec5dd2b3c Fix regression routing a large stack in a single route
fixes #4913
2022-05-20 09:37:20 -04:00
Douglas Christopher Wilson
631ada0c64 Fix hanging on large stack of sync routes
fixes #4899
2022-04-29 13:34:47 -04:00
phoenix
fd8e45c344 tests: mark stack overflow as long running
closes #4887
2022-04-20 19:52:20 -04:00
Douglas Christopher Wilson
708ac4cdf5 Fix handling very large stacks of sync middleware
closes #4891
2022-04-13 23:29:25 -04:00
Douglas Christopher Wilson
92c5ce59f5 deps: cookie@0.5.0 2022-04-11 22:51:13 -04:00
Hashen
1b2e097be2 tests: fix typo in description
closes #4882
2022-04-07 19:20:41 -04:00
Douglas Christopher Wilson
2e2d78c4d9 deps: on-finished@2.4.1 2022-04-03 01:15:37 -04:00
Douglas Christopher Wilson
32c558d414 deps: body-parser@1.20.0 2022-04-02 21:51:31 -04:00
Chris Barth
5855339455 Fix behavior of null/undefined as "maxAge" in res.cookie
fixes #3935
closes #3936
2022-03-26 23:11:48 -04:00
Nadav Ivgi
9482b82d0b Invoke default with same arguments as types in res.format
closes #3587
2022-03-26 01:29:40 -04:00
Douglas Christopher Wilson
03dc367187 Allow options without filename in res.download 2022-03-25 18:13:42 -04:00
Tommaso Tofacchi
0def9bb659 Add "root" option to res.download
fixes #4834
closes #4855
2022-03-25 00:08:38 -04:00
Jon Church
4847d0efa1 Deprecate string and non-integer arguments to res.status
closes #4223
2022-03-23 23:14:08 -04:00
Evan Hahn
c17fe05861 Ignore Object.prototype values in settings through app.set/app.get
closes #4802
closes #4803
2022-03-23 20:05:05 -04:00
Tito D. Kesumo Siregar
87279c08aa Support proper 205 responses using res.send
closes #4592
closes #4596
2022-03-23 20:05:05 -04:00
Douglas Christopher Wilson
291993d73c tests: expand res.sendFile options tests 2022-03-01 00:22:09 -05:00
Douglas Christopher Wilson
cf9f662655 tests: fix position of res.sendfile(path, options) test 2022-02-24 00:17:01 -05:00
Douglas Christopher Wilson
8da8f79c44 tests: fix callback in res.download test 2022-02-23 00:20:34 -05:00
Douglas Christopher Wilson
18f782bba9 tests: remove duplicate utils 2022-02-23 00:18:36 -05:00
Douglas Christopher Wilson
bc5ca05509 tests: remove usage of should 2022-02-21 19:54:52 -05:00
Douglas Christopher Wilson
9967ffbdc2 tests: update res.append to verify separate header lines 2022-02-21 19:23:25 -05:00
Douglas Christopher Wilson
7df0c840e0 tests: fix up app.locals tests 2022-02-21 19:07:26 -05:00
Douglas Christopher Wilson
d8ed591117 tests: fix req.acceptsLanguage tests 2022-02-20 23:49:42 -05:00
Douglas Christopher Wilson
8ee3420f0f tests: fix req.acceptsEncodings tests 2022-02-20 23:43:02 -05:00
Douglas Christopher Wilson
318fd4b543 Merge tag '4.17.3' 2022-02-17 00:27:11 -05:00
Douglas Christopher Wilson
a65913776d tests: use strict mode 2022-02-09 01:07:08 -05:00
Douglas Christopher Wilson
a39e409cf3 tests: prevent leaking changes to NODE_ENV 2022-02-08 18:40:07 -05:00
KoyamaSohei
82de4de5ab examples: fix path traversal in downloads example
closes #4120
2022-02-08 17:32:10 -05:00
Douglas Christopher Wilson
669c805615 deps: send@1.0.0-beta.1 2022-02-08 09:57:29 -05:00