From bda6e90146543756e0ebe682b1ee0f515247452b Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Thu, 14 Oct 2021 10:44:59 +0200 Subject: [PATCH] Drop readable-stream dependency --- lib/reply.js | 2 +- package.json | 1 - test/internals/reply.test.js | 2 +- test/stream.test.js | 4 ++-- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/reply.js b/lib/reply.js index e39274824c..2f79205f4d 100644 --- a/lib/reply.js +++ b/lib/reply.js @@ -1,6 +1,6 @@ 'use strict' -const eos = require('readable-stream').finished +const eos = require('stream').finished const statusCodes = require('http').STATUS_CODES const flatstr = require('flatstr') const FJS = require('fast-json-stringify') diff --git a/package.json b/package.json index bb8ef06d5d..2ba398872a 100644 --- a/package.json +++ b/package.json @@ -183,7 +183,6 @@ "light-my-request": "^4.2.0", "pino": "^6.13.0", "proxy-addr": "^2.0.7", - "readable-stream": "^3.4.0", "rfdc": "^1.1.4", "secure-json-parse": "^2.0.0", "semver": "^7.3.2", diff --git a/test/internals/reply.test.js b/test/internals/reply.test.js index e32fe5656f..117b86ec06 100644 --- a/test/internals/reply.test.js +++ b/test/internals/reply.test.js @@ -7,7 +7,7 @@ const http = require('http') const NotFound = require('http-errors').NotFound const EventEmitter = require('events').EventEmitter const Reply = require('../../lib/reply') -const { Writable } = require('readable-stream') +const { Writable } = require('stream') const { kReplyErrorHandlerCalled, kReplyHeaders, diff --git a/test/stream.test.js b/test/stream.test.js index b732509e75..9e5be5d9ab 100644 --- a/test/stream.test.js +++ b/test/stream.test.js @@ -145,7 +145,7 @@ test('onSend hook stream should work even if payload is not a proper stream', t t.plan(1) const reply = proxyquire('../lib/reply', { - 'readable-stream': { + stream: { finished: (...args) => { if (args.length === 2) { args[1](new Error('test-error')) } } @@ -186,7 +186,7 @@ test('onSend hook stream should work on payload with "close" ending function', t t.plan(1) const reply = proxyquire('../lib/reply', { - 'readable-stream': { + stream: { finished: (...args) => { if (args.length === 2) { args[1](new Error('test-error')) } }