From c5382a0a3b1fa501df926a69e28893ad9cd78c1e Mon Sep 17 00:00:00 2001 From: Federico Pereiro Date: Tue, 10 Jan 2017 13:54:13 +0100 Subject: [PATCH] Add tags, bump dependency. --- hitit.js | 23 ++++++++++++----------- package.json | 4 ++-- readme.md | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/hitit.js b/hitit.js index 85200e3..46961b5 100644 --- a/hitit.js +++ b/hitit.js @@ -1,5 +1,5 @@ /* -hitit - v0.1.0 +hitit - v0.1.1 Written by Federico Pereiro (fpereiro@gmail.com) and released into the public domain. @@ -26,6 +26,7 @@ Please refer to readme.md to read the annotated source (but not yet!). if (teishi.stop ([ ['options', o, 'object'], function () {return [ + ['options.tag', o.tag, 'string'], ['options.port', o.port, ['integer', 'function', 'undefined'], 'oneOf'], [type (o.port) === 'function', ['options.port', o.port, {min: 1, max: 65535}, teishi.test.range]], ['options.host', o.host, ['string', 'function', 'undefined'], 'oneOf'], @@ -52,9 +53,7 @@ Please refer to readme.md to read the annotated source (but not yet!). else return w; } - if (type (o.headers) === 'function') o.headers = resolve (o.headers); - - o.headers = dale.obj (o.headers || {}, resolve (state.headers) || {}, function (v, k) {return [k, v]}); + o.headers = dale.obj (resolve (o.headers) || {}, resolve (state.headers) || {}, function (v, k) {return [k, v]}); o.body = resolve (o.body); @@ -82,6 +81,7 @@ Please refer to readme.md to read the annotated source (but not yet!). response.on ('end', function () { var rdata = { + tag: o.tag, code: response.statusCode, headers: response.headers, body: response.body, @@ -147,7 +147,7 @@ Please refer to readme.md to read the annotated source (but not yet!). preproc (seq); var CB = function (error, data) { - log ('Starting request', (counter + 1) + '/' + fseq.length); + log ('Starting request', fseq [counter].tag, '(' + (counter + 1) + '/' + fseq.length + ')'); h.one (state, fseq [counter++], function (error, data) { if (error) return cb (error, hist); hist.push (data); @@ -162,12 +162,13 @@ Please refer to readme.md to read the annotated source (but not yet!). h.stdmap = function (req) { return { - method: req [0], - path: req [1], - headers: req [2], - body: req [3], - code: req [4], - apres: req [5] + tag: req [0], + method: req [1], + path: req [2], + headers: req [3], + body: req [4], + code: req [5], + apres: req [6] } } diff --git a/package.json b/package.json index b9dda0b..245fce8 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "hitit", - "version": "0.1.0", + "version": "0.1.1", "description": "Minimalistic tool for API testing.", "dependencies": { "dale": "4.1.0", - "teishi": "3.8.0" + "teishi": "3.9.0" }, "main": "hitit.js", "author": "Federico Pereiro ", diff --git a/readme.md b/readme.md index 5f7e1c9..f37e7b4 100644 --- a/readme.md +++ b/readme.md @@ -4,7 +4,7 @@ hitit is a minimalistic tool for testing an HTTP API. ## Current status of the project -The current version of hitit, v0.1.0, is considered to be *unstable* and *incomplete*. [Suggestions](https://github.com/fpereiro/hitit/issues) and [patches](https://github.com/fpereiro/hitit/pulls) are welcome. Future changes planned are: +The current version of hitit, v0.1.1, is considered to be *unstable* and *incomplete*. [Suggestions](https://github.com/fpereiro/hitit/issues) and [patches](https://github.com/fpereiro/hitit/pulls) are welcome. Future changes planned are: - Support for `multipart` uploads and downloads. - Support for concurrent testing (a.k.a stress testing).