From 3a628f5ce951b064454709370b0907b819fa2e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Lengyel?= Date: Mon, 24 Jan 2022 14:48:00 +0100 Subject: [PATCH] feat (test): aborted request handling in reply.send --- test/internals/reply.test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/internals/reply.test.js b/test/internals/reply.test.js index 4545eda1dbe..9f0646e7dc3 100644 --- a/test/internals/reply.test.js +++ b/test/internals/reply.test.js @@ -106,6 +106,19 @@ test('reply.serializer should set a custom serializer', t => { t.equal(reply[kReplySerializer], 'serializer') }) +test('reply.send handles aborted requests', t => { + t.plan(1) + const response = { + setHeader: () => {}, + hasHeader: () => false, + getHeader: () => undefined, + writeHead: () => {}, + end: () => {} + } + const reply = new Reply(response, { raw: { aborted: true } }) + t.equal(reply.send('hello'), reply) +}) + test('reply.serializer should support running preSerialization hooks', t => { t.plan(3) const fastify = require('../..')()