From 18dc5979aaed524e20b4446ba679350e29058a73 Mon Sep 17 00:00:00 2001 From: Ethan Davis Date: Mon, 31 Dec 2018 18:34:14 -0800 Subject: [PATCH] 3.2.1: Improve handling of buffers (Resolves #30) - Resolved issue by updating centra library. - Added relevant test. --- package-lock.json | 8 ++++---- package.json | 4 ++-- tests/test.js | 10 ++++++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8cc51cd..4ac6110 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,13 @@ { "name": "phin", - "version": "2.9.3", + "version": "3.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { "centra": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/centra/-/centra-2.1.0.tgz", - "integrity": "sha512-JATN/v58MpRKe9wr1XwopPvExWAjJ01mfQxngCv/yBYmOYK+klkQg33V+085DZjJ8CqhBsbLeH9IKztBMF6k1g==" + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/centra/-/centra-2.2.1.tgz", + "integrity": "sha512-CZn251LL3/mO+4yArW6PWsEqRiP4SgV+K/edBEdZ5R/48rjfuVwPd9bduW062U37i2Ywv8Kz/icg8tpJcuP60g==" }, "whew": { "version": "1.1.3", diff --git a/package.json b/package.json index d542e92..be12571 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "phin", - "version": "3.2.0", + "version": "3.2.1", "description": "Ultra-simple, lightweight, dependency-free Node.JS HTTP request client", "main": "lib/phin.min.js", "scripts": { @@ -38,6 +38,6 @@ "node": ">= 8" }, "dependencies": { - "centra": "^2.1.0" + "centra": "^2.2.1" } } diff --git a/tests/test.js b/tests/test.js index 3ffb594..ef21efa 100644 --- a/tests/test.js +++ b/tests/test.js @@ -387,4 +387,14 @@ w.add('Defaults with object options', async (result) => { result(res.statusCode === 200 && res.body.toString() === 'Got your POST.', res.statusCode) }) +w.add('Buffer body', async (result) => { + const res = await pp({ + 'method': 'POST', + 'url': 'http://localhost:5136/testpost', + 'data': Buffer.from('Hey there!') + }) + + result(res.statusCode === 200, res.body.toString()) +}) + var httpServer = http.createServer(httpHandler).listen(5136, w.test) \ No newline at end of file