Repository navigation
test: cover unsatisfiable and invalid ranges in req.range - #7572
saiyam-jain-dev wants to merge 2 commits into
Conversation
|
These tests pass with |
Signed-off-by: Saiyam Jain <jimisierra2@gmail.com>
de760e6 to
a948d27
Compare
|
Good catch! I've updated both invalid cases to use |
yxshee
left a comment
There was a problem hiding this comment.
Verified the update for @zengks's point: with range-parser@1.2.1 (the minimum Express allows) and 1.3.0 (what installs today), bytes 0-2 returns -2 and bytes=200-300 returns -1 for size 120, both with and without { combine: true }. So the four new assertions hold across the supported range.
Full suite on this branch: 1294 passing. LGTM.
|
Updated in 542ff1b: moved both tests inside |
Add unit test coverage in
test/req.range.jsfor the error return values documented inlib/request.js:The existing test suite verified parsed ranges, size capping,
.type, and undefined returns when no header is present, but lacked coverage for:-1when the range is unsatisfiable (e.g.bytes=200-300for size 120)-2when the range is syntactically invalid (e.g.bytes 0-2missing=){ combine: true })All 1,294 tests pass (
npm test) andnpm run lintpasses with zero errors.