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

loadtest

Package Overview
Dependencies
Maintainers
1
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loadtest - npm Package Compare versions

Comparing version 0.2.9 to 0.2.10

10

bin/loadtest.js

@@ -12,4 +12,6 @@ #!/usr/bin/env node

var fs = require('fs');
var urlLib = require('url');
var loadTest = require('../lib/loadtest.js');
var headers = require('../lib/headers.js');
var packageJson = require(__dirname + '/../package.json');

@@ -22,3 +24,2 @@ // globals

{
var packageJson = require(__dirname + '/../package.json');
console.log('Loadtest version: %s', packageJson.version);

@@ -59,5 +60,10 @@ process.exit(0);

}
options.headers = [
['host', urlLib.parse(options.url).host],
['user-agent', 'loadtest/' + packageJson.version],
['accept', '*/*'],
];
if (options.rawHeaders)
{
options.headers = headers.readHeaders(options.rawHeaders);
headers.addHeaders(options.rawHeaders, options.headers);
console.log('headers: %s, %j', typeof options.headers, options.headers);

@@ -64,0 +70,0 @@ }

24

lib/headers.js

@@ -14,7 +14,6 @@ 'use strict';

/**
* Read all headers and return in a suitable array.
* Add all raw headers given to the given array.
*/
exports.readHeaders = function(rawHeaders)
exports.addHeaders = function(rawHeaders, headers)
{
var headers = [];
if (Array.isArray(rawHeaders))

@@ -35,3 +34,2 @@ {

}
return headers;
};

@@ -51,3 +49,3 @@

var value = pieces[1];
headers.push([key, value]);
headers.push([key.toLowerCase(), value]);
}

@@ -69,8 +67,13 @@

headers: [['k', 'v'], ['k2', 'v2']],
}
},
{
raw: 'K:v',
headers: [['k', 'v']],
},
];
tests.forEach(function(test)
{
var result = exports.readHeaders(test.raw);
testing.assertEquals(result, test.headers, 'Wrong headers', callback);
var headers = [];
exports.addHeaders(test.raw, headers);
testing.assertEquals(headers, test.headers, 'Wrong headers', callback);
});

@@ -125,3 +128,6 @@ testing.success(callback);

{
testing.run([testAddHeaders, testConvert], callback);
testing.run([
testAddHeaders,
testConvert
], callback);
};

@@ -128,0 +134,0 @@

@@ -108,3 +108,3 @@ 'use strict';

}
// log.info('Options: %j', options);
log.debug('Options: %j', options);
}

@@ -111,0 +111,0 @@

{
"name": "loadtest",
"version": "0.2.9",
"version": "0.2.10",
"description": "Run load tests for your web application. Mostly ab-compatible interface, with an option to force requests per second. Includes an API for automated load testing.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/alexfernandez/loadtest",

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