diff --git a/README.md b/README.md index cfb2863..2232a82 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +# Forked +@jonahss is working on this fork. See: https://github.com/jeffbski/bench-rest/pull/29 + # bench-rest benchmark REST API's Node.js client module for easy load testing / benchmarking REST (HTTP/HTTPS) API's using a simple structure/DSL can create REST flows with setup and teardown and returns (measured) metrics. diff --git a/lib/bench-rest.js b/lib/bench-rest.js index 408ffd0..7bb2e43 100644 --- a/lib/bench-rest.js +++ b/lib/bench-rest.js @@ -110,11 +110,11 @@ function benchmark(flow, runOptions) { }; function pushOnQueue() { - var tokens = { INDEX: index }; + var tokens = {INDEX: index} queue.push({ env: { index: index, jar: request.jar(), user: runOptions.user, password: runOptions.password, etags: {}, iterCtx: {}, stats: stats }, beforeMain: bindSubtituteFnsWithTokens(flow.beforeMain, tokens), - main: bindSubtituteFnsWithTokens(flow.main, tokens), + main: typeof flow === 'function' ? flow(index).main : flow.main, afterMain: bindSubtituteFnsWithTokens(flow.afterMain, tokens) }); index += 1; @@ -163,10 +163,6 @@ function ensureFlowProperties(flow) { flow = { main: [flow] }; } - if (!Array.isArray(flow.main)) { - throw new Error('benchmark flow requires main operations, missing flow.main?'); - } - if (!flow.before) flow.before = []; if (!flow.after) flow.after = []; if (!flow.beforeMain) flow.beforeMain = []; diff --git a/package.json b/package.json index 2d011d4..d0c4b44 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { - "name": "bench-rest", + "name": "bench-rest-jonahss", "description": "bench-rest - benchmark REST (HTTP/HTTPS) API's. Node.js client module for easy load testing / benchmarking REST API' using a simple structure/DSL can create REST flows with setup and teardown and returns (measured) metrics.", - "version": "1.2.4", + "version": "2.0.0", "author": "Jeff Barczewski ", "repository": { "type": "git", - "url": "http://github.com/jeffbski/bench-rest.git" + "url": "http://github.com/jonahss/bench-rest.git" }, "bugs": { - "url": "http://github.com/jeffbski/bench-rest/issues" + "url": "http://github.com/jonahss/bench-rest/issues" }, "license": "MIT", "main": "lib/bench-rest",