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 3.1.1 to 3.1.2

8

lib/Headers.js

@@ -117,3 +117,3 @@ var foldHeaderLine = require('./foldHeaderLine'),

if (this.valuesByName[headerNameLowerCase]) {
Array.prototype.push.apply(this.valuesByName[headerNameLowerCase], value)
Array.prototype.push.apply(this.valuesByName[headerNameLowerCase], value);
} else {

@@ -170,3 +170,7 @@ this.valuesByName[headerNameLowerCase] = [].concat(value);

if (Array.isArray(valueOrValues)) {
this.valuesByName[headerNameLowerCase] = valueOrValues.map(String);
if (valueOrValues.length === 0) {
delete this.valuesByName[headerNameLowerCase];
} else {
this.valuesByName[headerNameLowerCase] = valueOrValues.map(String);
}
} else {

@@ -173,0 +177,0 @@ (this.valuesByName[headerNameLowerCase] = this.valuesByName[headerNameLowerCase] || []).push(String(valueOrValues));

{
"name": "messy",
"version": "3.1.1",
"version": "3.1.2",
"description": "Object model for HTTP and RFC822 messages",

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

@@ -126,2 +126,26 @@ /*global describe, it*/

});
describe('#set', function () {
it('should preserve existing values when adding a string value', function () {
var headers = new Headers({foo: 'bar'});
expect(headers.toString(), 'to equal', 'Foo: bar\r\n');
headers.set('foo', 'quux');
expect(headers.toString(), 'to equal', 'Foo: bar\r\nFoo: quux\r\n');
});
it('should remove all existing values when passed an empty array', function () {
var headers = new Headers({foo: 'bar'});
expect(headers.toString(), 'to equal', 'Foo: bar\r\n');
headers.set('foo', []);
expect(headers.valuesByName.foo, 'to be undefined');
expect(headers.toString(), 'to equal', '');
});
it('should replace existing values when passed an array of strings', function () {
var headers = new Headers({foo: 'bar'});
expect(headers.toString(), 'to equal', 'Foo: bar\r\n');
headers.set('foo', ['hey']);
expect(headers.toString(), 'to equal', 'Foo: hey\r\n');
});
});
});
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