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 8.0.7 to 8.0.9

.loadtestrc

3

doc/api.md

@@ -112,3 +112,4 @@ # loadtest API

A map of headers. Each header should be an entry in the map with the value given as a string.
An object containing headers of the form `key: 'value'}.
Each attribute of the object should be a header with the value given as a string.
If you want to have several values for a header, write a single value separated by semicolons,

@@ -115,0 +116,0 @@ like this:

@@ -9,6 +9,10 @@

rawHeaders.forEach(function(header) {
addHeader(header, headers);
addTextHeader(header, headers);
});
} else if (typeof rawHeaders == 'string') {
addHeader(rawHeaders, headers);
addTextHeader(rawHeaders, headers);
} else if (typeof rawHeaders == 'object') {
for (const key of Object.keys(rawHeaders)) {
addHeader(key, rawHeaders[key], headers)
}
} else {

@@ -19,6 +23,3 @@ console.error('Invalid header structure %j, it should be an array', rawHeaders);

/**
* Add a single header to an array.
*/
function addHeader(rawHeader, headers) {
function addTextHeader(rawHeader, headers) {
if (!rawHeader.includes(':')) {

@@ -30,2 +31,6 @@ return console.error('Invalid header %s, it should be in the form -H key:value', rawHeader);

const value = rawHeader.substr(index + 1);
addHeader(key, value, headers)
}
function addHeader(key, value, headers) {
headers[key.toLowerCase()] = value;

@@ -39,5 +44,5 @@ }

if(!headers['user-agent']) {
headers['user-agent'] = 'node.js loadtest bot';
addHeader('user-agent', 'node.js loadtest bot', headers)
}
}

@@ -121,3 +121,3 @@ import {readFile} from 'fs/promises'

}
if (typeof this.requestGenerator == 'string') {
if (this.requestGenerator && typeof this.requestGenerator == 'string') {
this.requestGenerator = await import(this.requestGenerator)

@@ -124,0 +124,0 @@ }

{
"name": "loadtest",
"version": "8.0.7",
"version": "8.0.9",
"type": "module",

@@ -5,0 +5,0 @@ "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.",

@@ -6,3 +6,3 @@ import testing from 'testing'

function testAddHeaders(callback) {
const tests = [ {
const tests = [{
raw: 'k:v',

@@ -22,4 +22,6 @@ headers: { 'k': 'v' }

headers: { 'k': 'v:w' }
}
];
}, {
raw: {accept: 'text/plain;text/html'},
headers: {accept: 'text/plain;text/html'},
}];
tests.forEach(function(test) {

@@ -26,0 +28,0 @@ const headers = {};

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