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 1.2.0 to 1.2.1

12

lib/Message.js

@@ -137,2 +137,14 @@ /*global unescape*/

Message.prototype.hasEmptyBody = function () {
if (typeof this.body === 'string') {
return this.body.length === 0;
} else if (typeof Buffer === 'function' && Buffer.isBuffer(this.body)) {
return this.body.length === 0;
} else if (this.body && typeof this.body === 'object') {
return false;
} else {
return true;
}
};
function isTextualContentType(contentType) {

@@ -139,0 +151,0 @@ if (typeof contentType === 'string') {

2

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

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

@@ -174,2 +174,32 @@ /*global describe, it*/

});
describe('#hasEmptyBody', function () {
it('should consider a zero length Buffer to be an empty body', function () {
expect(new Message({body: new Buffer([])}).hasEmptyBody(), 'to be true');
});
it('should consider a non-zero length Buffer not to be an empty body', function () {
expect(new Message({body: new Buffer([123])}).hasEmptyBody(), 'to be false');
});
it('should consider the empty string to be an empty body', function () {
expect(new Message({body: ''}).hasEmptyBody(), 'to be true');
});
it('should consider a non-empty string not to be an empty body', function () {
expect(new Message({body: 'foo'}).hasEmptyBody(), 'to be false');
});
it('should consider undefined to be an empty body', function () {
expect(new Message({body: undefined}).hasEmptyBody(), 'to be true');
});
it('should consider an absent body to be empty', function () {
expect(new Message().hasEmptyBody(), 'to be true');
});
it('should consider an empty Object to be a non-empty body', function () {
expect(new Message({body: {}}).hasEmptyBody(), 'to be false');
});
});
});
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