From 71ceaf852da324aa701f57932a99740b0ee20747 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Mon, 24 Apr 2023 22:37:27 +0200 Subject: [PATCH] fix tests for node 20 Signed-off-by: Matteo Collina --- test/hooks.test.js | 4 ++-- test/router.test.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/hooks.test.js b/test/hooks.test.js index 873ca62..2f46a21 100644 --- a/test/hooks.test.js +++ b/test/hooks.test.js @@ -276,7 +276,7 @@ test('Should not hijack reply for a normal http request in the internal onError const httpClient = net.createConnection({ port }, () => { t.teardown(httpClient.destroy.bind(httpClient)) - httpClient.write('GET / HTTP/1.1\r\n\r\n') + httpClient.write('GET / HTTP/1.1\r\nHOST: localhost\r\n\r\n') httpClient.once('data', data => { t.match(data.toString(), /Fail/i) }) @@ -352,7 +352,7 @@ test('Should not hijack reply for an normal request to a websocket route that is const httpClient = net.createConnection({ port }, () => { t.teardown(httpClient.destroy.bind(httpClient)) - httpClient.write('GET /echo HTTP/1.1\r\n\r\n') + httpClient.write('GET /echo HTTP/1.1\r\nHOST: localhost\r\n\r\n') httpClient.once('data', data => { t.match(data.toString(), /not found/i) }) diff --git a/test/router.test.js b/test/router.test.js index 0ae0dad..5790256 100644 --- a/test/router.test.js +++ b/test/router.test.js @@ -306,7 +306,7 @@ test('Should invoke the correct handler depending on the headers', t => { const port = fastify.server.address().port const httpClient = net.createConnection({ port }, () => { - httpClient.write('GET / HTTP/1.1\r\n\r\n') + httpClient.write('GET / HTTP/1.1\r\nHOST: localhost\r\n\r\n') httpClient.once('data', data => { t.match(data.toString(), /hi from handler/i) httpClient.end()