Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

messy

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

messy - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

13

lib/Message.js
/*global unescape*/
var Headers = require('./Headers'),
isRegExp = require('./isRegExp'),
rfc2231 = require('rfc2231'),
iconvLite = require('iconv-lite'),
quotedPrintable = require('quoted-printable'),
utf8 = require('utf8');
quotedPrintable = require('quoted-printable');

@@ -138,3 +136,3 @@ function quoteRegExp(str) {

chunks.push(new Buffer('\r\n--' + this.boundary + '--\r\n'))
chunks.push(new Buffer('\r\n--' + this.boundary + '--\r\n'));
return Buffer.concat(chunks);

@@ -175,2 +173,5 @@ } else {

} else if (contentTransferEncoding === 'base64') {
if (typeof Buffer === 'function' && Buffer.isBuffer(decodedBody)) {
decodedBody = decodedBody.toString('ascii');
}
decodedBody = new Buffer(decodedBody, 'base64');

@@ -182,3 +183,3 @@ contentTransferEncodingIsHonored = true;

}
if (this.hasTextualContentType && contentTransferEncodingIsHonored) {
if (this.hasTextualContentType && contentTransferEncodingIsHonored && typeof decodedBody !== 'string') {
var charset = this.headers.parameter('Content-Type', 'charset') || 'iso-8859-1';

@@ -292,3 +293,3 @@ if (iconvLite.encodingExists(charset)) {

return this.serialize(maxLineLength, true);
}
};

@@ -295,0 +296,0 @@ Message.prototype.equals = function (other) {

{
"name": "messy",
"version": "4.0.0",
"version": "4.0.1",
"description": "Object model for HTTP and RFC822 messages",

@@ -39,5 +39,4 @@ "main": "lib/index.js",

"rfc2231": "1.2.0",
"underscore": "^1.6.0",
"utf8": "2.1.0"
"underscore": "^1.6.0"
}
}

@@ -206,3 +206,3 @@ /*global describe, it*/

var headers = new Headers('Foo: hey');
headers.parameter('Foo', 'blah', 'baz')
headers.parameter('Foo', 'blah', 'baz');
expect(headers.toString(), 'to equal', 'Foo: hey; blah=baz\r\n');

@@ -213,3 +213,3 @@ });

var headers = new Headers('Foo: hey; blah=quux');
headers.parameter('Foo', 'blah', 'baz')
headers.parameter('Foo', 'blah', 'baz');
expect(headers.toString(), 'to equal', 'Foo: hey; blah=baz\r\n');

@@ -216,0 +216,0 @@ });

@@ -307,3 +307,3 @@ /*global describe, it*/

describe('#decodedBody', function () {
it('should decode a base64 body to a string when the Content-Transfer-Encoding is base64 and the Content-Type is textual', function () {
it('should decode a base64 body to a string when the Content-Transfer-Encoding is base64 and the Content-Type is textual and the body is stored as a string', function () {
expect(new Message(

@@ -317,2 +317,11 @@ 'Content-Type: text/plain; charset=UTF-8\r\n' +

it('should decode a base64 body to a string when the Content-Transfer-Encoding is base64 and the Content-Type is textual and the body is stored as a Buffer', function () {
expect(new Message(new Buffer(
'Content-Type: text/plain; charset=UTF-8\r\n' +
'Content-Transfer-Encoding: base64\r\n' +
'\r\n' +
'Zm9v\r\n')
).decodedBody, 'to equal', 'foo');
});
it('should decode a base64 body to a Buffer when the Content-Transfer-Encoding is base64 and the Content-Type is not textual', function () {

@@ -354,2 +363,10 @@ expect(new Message(

it('should provide a decoded body when the body is already given as a string with no Content-Transfer-Encoding, even when a charset is defined', function () {
expect(new Message(
'Content-Type: text/plain; charset=UTF-8\r\n' +
'\r\n' +
'Abcdef\r\n'
).decodedBody, 'to equal', 'Abcdef\r\n');
});
it('should support quoted-printable with no Content-Transfer-Encoding', function () {

@@ -356,0 +373,0 @@ expect(new Message(

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc