Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added limit() tests. Closes #476

  • Loading branch information...
commit ce132689fdcbdbbe6688a1601873e46790bffd4a 1 parent 9c3fc8e
@tj tj authored
Showing with 30 additions and 0 deletions.
  1. +30 −0 test/limit.js
View
30 test/limit.js
@@ -0,0 +1,30 @@
+
+var connect = require('../');
+
+var app = connect();
+
+app.use(connect.limit('5kb'));
+
+app.use(function(req, res){
+ res.end('stuff');
+});
+
+describe('connect.limit()', function(){
+ describe('when Content-Length is below', function(){
+ it('should bypass limit()', function(done){
+ app.request()
+ .post('/')
+ .set('Content-Length', 500)
+ .expect(200, done);
+ })
+ })
+
+ describe('when Content-Length is too large', function(){
+ it('should respond with 413', function(done){
+ app.request()
+ .post('/')
+ .set('Content-Length', 10 * 1024)
+ .expect(413, done);
+ })
+ })
+})
Please sign in to comment.
Something went wrong with that request. Please try again.