Skip to content

Commit bd638c1

Browse files
committed
include test
1 parent f8e0fd8 commit bd638c1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/req.range.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,26 @@ describe('req', function(){
4444
.expect(200, '[{"start":0,"end":74}]', done)
4545
})
4646

47+
it('should throw TypeError for invalid size', function () {
48+
var app = express();
49+
50+
app.use(function (req, res) {
51+
try {
52+
req.range(-1);
53+
} catch (err) {
54+
res.status(500).send(err.name + ': ' + err.message);
55+
return;
56+
}
57+
res.send('no error');
58+
});
59+
60+
return request(app)
61+
.get('/')
62+
.set('Range', 'bytes=0-10')
63+
.expect(500)
64+
.expect(/TypeError: size must be a non-negative integer to req\.range/);
65+
});
66+
4767
it('should have a .type', function (done) {
4868
var app = express()
4969

0 commit comments

Comments
 (0)