loadtest 8.0.4 → 8.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/options.js CHANGED
@@ -71,6 +71,9 @@ class Options {
71
71
  if (options.data) {
72
72
  this.body = options.data
73
73
  }
74
+ if (options.body) {
75
+ this.body = options.body
76
+ }
74
77
  // Allow a post body string in options
75
78
  // Ex -P '{"foo": "bar"}'
76
79
  if (options.postBody) {
@@ -129,7 +132,8 @@ async function readBody(filename) {
129
132
  throw new Error(`Invalid file to open for body: ${filename}`);
130
133
  }
131
134
  if (path.extname(filename) === '.js') {
132
- return await import(new URL(filename, `file://${process.cwd()}/`))
135
+ const fn = await import(new URL(filename, `file://${process.cwd()}/`));
136
+ return 'default' in fn ? fn.default : fn;
133
137
  }
134
138
  return await readFile(filename, {encoding: 'utf8'});
135
139
  }
package/lib/tcpClient.js CHANGED
@@ -70,7 +70,8 @@ export class TcpClient {
70
70
  const line = `${header}: ${value}`
71
71
  lines.push(line)
72
72
  }
73
- lines.push(`\r\n`)
73
+ lines.push('')
74
+ lines.push(body)
74
75
  const text = lines.join('\r\n')
75
76
  return Buffer.from(text)
76
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loadtest",
3
- "version": "8.0.4",
3
+ "version": "8.0.6",
4
4
  "type": "module",
5
5
  "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
6
  "homepage": "https://github.com/alexfernandez/loadtest",
@@ -80,7 +80,7 @@ function testWSIntegration(callback) {
80
80
  }
81
81
  const options = {
82
82
  url: `ws://localhost:${port}`,
83
- maxRequests: 10,
83
+ maxRequests: 100,
84
84
  concurrency: 10,
85
85
  body: {
86
86
  /*