Comparing version 1.2.1 to 1.2.2
@@ -0,1 +1,6 @@ | ||
1.2.2 / 2014-06-19 | ||
================== | ||
* Send invalid encoding error to callback | ||
1.2.1 / 2014-06-15 | ||
@@ -2,0 +7,0 @@ ================== |
15
index.js
@@ -74,3 +74,16 @@ var bytes = require('bytes') | ||
var received = 0 | ||
var decoder = getDecoder(encoding) | ||
var decoder | ||
try { | ||
decoder = getDecoder(encoding) | ||
} catch (err) { | ||
if (typeof stream.pause === 'function') | ||
stream.pause() | ||
process.nextTick(function () { | ||
done(err) | ||
}) | ||
return defer | ||
} | ||
var buffer = decoder | ||
@@ -77,0 +90,0 @@ ? '' |
{ | ||
"name": "raw-body", | ||
"description": "Get and validate the raw body of a readable stream.", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"author": "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -70,4 +70,5 @@ # raw-body | ||
- `received` - the received bytes | ||
- `encoding` - the invalid encoding | ||
- `status` and `statusCode` - the corresponding status code for the error | ||
- `type` - either `entity.too.large`, `request.size.invalid`, or `stream.encoding.set` | ||
- `type` - either `entity.too.large`, `request.size.invalid`, `stream.encoding.set`, or `encoding.unsupported` | ||
@@ -74,0 +75,0 @@ - `res` - the result, either as a `String` if an encoding was set or a `Buffer` otherwise. |
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
10797
154
104