Comparing version 6.6.2 to 6.7.0
@@ -25,2 +25,6 @@ module.exports = function decodeTransferEncodingChunked(body) { | ||
index += nextChunkLength; | ||
// We do a best effort and exit if we've reached the end of some partial body | ||
if (index === body.length) { | ||
return Buffer.concat(chunks); | ||
} | ||
if (index + 2 >= body.length || body[index] !== 0xd || body[index + 1] !== 0xa) { | ||
@@ -54,2 +58,6 @@ throw new Error('decodeTransferEncodingChunked: Parse error, expecting \\r\\n after chunk'); | ||
index += nextChunkLength; | ||
// We do a best effort and exit if we've reached the end of some partial body | ||
if (index === body.length) { | ||
return chunks.join(''); | ||
} | ||
if (index + 2 >= body.length || body[index] !== '\r' || body[index + 1] !== '\n') { | ||
@@ -56,0 +64,0 @@ throw new Error('decodeTransferEncodingChunked: Parse error, expecting \\r\\n after chunk'); |
{ | ||
"name": "messy", | ||
"version": "6.6.2", | ||
"version": "6.7.0", | ||
"description": "Object model for HTTP and RFC822 messages", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -453,2 +453,33 @@ /*global describe, it*/ | ||
it('should decode Transfer-Encoding:chunked when a partial body is provided as a string', function () { | ||
expect(new Message( | ||
'Content-Type: text/plain; charset=UTF-8\r\n' + | ||
'Transfer-Encoding: chunked\r\n' + | ||
'\r\n' + | ||
'4\r\n' + | ||
'Wiki\r\n' + | ||
'5\r\n' + | ||
'pedia\r\n' + | ||
'e\r\n' + | ||
' in\r\n\r\nchunks.' | ||
).unchunkedBody, 'to equal', 'Wikipedia in\r\n\r\nchunks.'); | ||
}); | ||
it('should decode Transfer-Encoding:chunked when a partial body is provided as a Buffer', function () { | ||
expect(new Message( | ||
new Buffer( | ||
'Content-Type: text/plain; charset=UTF-8\r\n' + | ||
'Transfer-Encoding: chunked\r\n' + | ||
'\r\n' + | ||
'4\r\n' + | ||
'Wiki\r\n' + | ||
'5\r\n' + | ||
'pedia\r\n' + | ||
'e\r\n' + | ||
' in\r\n\r\nchunks.', | ||
'utf-8' | ||
) | ||
).unchunkedBody, 'to equal', new Buffer('Wikipedia in\r\n\r\nchunks.', 'utf-8')); | ||
}); | ||
describe('when accessed as a setter', function () { | ||
@@ -455,0 +486,0 @@ it('should update rawBody and body', function () { |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
171975
3619
1