Comparing version 1.1.1 to 1.1.2
@@ -29,3 +29,3 @@ | ||
exports.version = '1.1.1'; | ||
exports.version = '1.1.2'; | ||
@@ -32,0 +32,0 @@ /** |
@@ -11,4 +11,6 @@ | ||
* | ||
* When exceeded, the request will emit an "error" event, | ||
* and the limit can be checked via `error.limit`. | ||
* When exceeded, `next()` is invoked with an exception | ||
* unless the request "limit" event has one or more | ||
* listeners. The limit can be checked via `error.limit`, | ||
* and bytes received via `error.received`. | ||
* | ||
@@ -24,2 +26,14 @@ * A string representation of the bytesize may also be passed, | ||
* | ||
* Example route usage | ||
* | ||
* req.on('limit', function(err){ | ||
* res.end('uploaded failed due to exceeding ' + err.limit + ' bytes'); | ||
* }); | ||
* | ||
* req.on('end', function(err){ | ||
* res.end('upload successful'); | ||
* }); | ||
* | ||
* TODO: utilize Content-Length | ||
* | ||
* @param {Number|String} bytes | ||
@@ -45,6 +59,11 @@ * @return {Function} | ||
if (received > bytes && !done) { | ||
done = true; | ||
var err = new Error('limit of ' + bytes + ' bytes exceeded'); | ||
err.limit = bytes; | ||
req.emit('error', err); | ||
err.received = received; | ||
done = true; | ||
if (req.listeners('limit').length) { | ||
req.emit('limit', err); | ||
} else { | ||
next(err); | ||
} | ||
} | ||
@@ -51,0 +70,0 @@ }); |
{ | ||
"name": "connect", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "High performance middleware framework", | ||
@@ -5,0 +5,0 @@ "keywords": ["framework", "web", "middleware", "connect", "rack"], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77294
2814