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

messy

Package Overview
Dependencies
Maintainers
3
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 6.8.0 to 6.8.1

5

lib/Message.js

@@ -176,3 +176,6 @@ /*global unescape, btoa, atob, JSON*/

this._unchunkedBody = this.body;
if (this.isJson && typeof this._unchunkedBody !== 'undefined' && (typeof Buffer === 'undefined' || !Buffer.isBuffer(this._unchunkedBody))) {
if (
((this.isJson && typeof this._unchunkedBody !== 'undefined') || this._unchunkedBody && typeof this._unchunkedBody === 'object') &&
(typeof Buffer === 'undefined' || !Buffer.isBuffer(this._unchunkedBody))
) {
try {

@@ -179,0 +182,0 @@ this._unchunkedBody = JSON.stringify(this._unchunkedBody);

2

package.json
{
"name": "messy",
"version": "6.8.0",
"version": "6.8.1",
"description": "Object model for HTTP and RFC822 messages",

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

@@ -889,4 +889,4 @@ /*global describe, it*/

it('should support passing a JSON body as an object despite a non-JSON Content-Type', function () {
expect(new Message({
describe('with a JSON body provided as an object despite a non-JSON Content-Type', function () {
var message = new Message({
headers: {

@@ -898,8 +898,16 @@ 'Content-Type': 'application/octet-stream'

}
}).toString(), 'to equal',
'Content-Type: application/octet-stream\r\n' +
'\r\n' +
'{"foo":123}'
);
});
it('should stringify correctly', function () {
expect(message.toString(), 'to equal',
'Content-Type: application/octet-stream\r\n' +
'\r\n' +
'{"foo":123}'
);
});
it('should have the correct unchunkedBody', function () {
expect(message.unchunkedBody.toString('utf-8'), 'to equal', '{"foo":123}');
});
});
});
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