From 6d0f607cf1f2570074cb911664ef4d6d90f366a5 Mon Sep 17 00:00:00 2001 From: Marko Obrovac Date: Mon, 26 Aug 2019 12:32:41 +0200 Subject: [PATCH] Update deps, remove `new Buffer` and fix tests; release v0.12.7 --- .gitignore | 1 + lib/server.js | 4 ++-- package.json | 18 +++++++++--------- test/hyperswitch/hyperswitch.js | 6 ++++-- test/streaming/stream_module.js | 4 ++-- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 08ec64d0..e4efec0f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +package-lock.json coverage .nyc_output /node_modules diff --git a/lib/server.js b/lib/server.js index 235bca34..0df2df5c 100644 --- a/lib/server.js +++ b/lib/server.js @@ -188,9 +188,9 @@ function handleResponse(opts, req, resp, response) { // Convert to a buffer if (typeof body === 'object') { rh['content-type'] = rh['content-type'] || 'application/json'; - body = new Buffer(JSON.stringify(body)); + body = Buffer.from(JSON.stringify(body)); } else { - body = new Buffer(body); + body = Buffer.from(body); } } diff --git a/package.json b/package.json index c898b9cc..849c998a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hyperswitch", - "version": "0.12.6", + "version": "0.12.7", "description": "REST API creation framework", "main": "index.js", "scripts": { @@ -25,16 +25,16 @@ }, "homepage": "https://github.com/wikimedia/hyperswitch", "dependencies": { - "ajv": "^6.5.4", - "bluebird": "^3.5.2", - "busboy": "^0.2.14", + "ajv": "^6.10.2", + "bluebird": "^3.5.5", + "busboy": "^0.3.1", "fast-json-stable-stringify": "^2.0.0", - "js-yaml": "^3.12.0", - "preq": "^0.5.8", + "js-yaml": "^3.13.1", + "preq": "^0.5.11", "regexp-utils": "^0.3.2", - "swagger-router": "^0.7.3", - "swagger-ui-dist": "^3.22.0", - "uuid": "^3.3.2" + "swagger-router": "^0.7.4", + "swagger-ui-dist": "^3.23.6", + "uuid": "^3.3.3" }, "devDependencies": { "coveralls": "^3.0.2", diff --git a/test/hyperswitch/hyperswitch.js b/test/hyperswitch/hyperswitch.js index 0b8ffa19..b4e02327 100644 --- a/test/hyperswitch/hyperswitch.js +++ b/test/hyperswitch/hyperswitch.js @@ -30,7 +30,7 @@ describe('HyperSwitch context',() => { .then(function (res) { assert.deepEqual(res.status, 200); assert.deepEqual(res.headers.test, 'test'); - assert.deepEqual(res.body, new Buffer('')); + assert.deepEqual(res.body, Buffer.from('')); }); }); @@ -75,7 +75,9 @@ describe('HyperSwitch context',() => { type: 'https://mediawiki.org/wiki/HyperSwitch/errors/not_found#route', title: 'Not found.', method: 'get', - uri: '/this_path_does_not_exist/' + uri: '/this_path_does_not_exist/', + internalURI: 'http://localhost:12345/this_path_does_not_exist/', + internalMethod: 'get' }); }); }); diff --git a/test/streaming/stream_module.js b/test/streaming/stream_module.js index 0d6dd096..88fceb71 100644 --- a/test/streaming/stream_module.js +++ b/test/streaming/stream_module.js @@ -16,10 +16,10 @@ function hello(hyper, req) { function buffer(hyper, req) { var body = new stream.PassThrough(); - body.write(new Buffer('hel')); + body.write(Buffer.from('hel')); // Delay the final write to test async production. setTimeout(() => { - body.end(new Buffer('lo')); + body.end(Buffer.from('lo')); }, 500); return {