From 7e4b79da639dcae2a2d6bf01cfeba0494ef90033 Mon Sep 17 00:00:00 2001 From: "Peter A. Jonsson" Date: Wed, 1 May 2024 19:19:25 +0200 Subject: [PATCH 1/2] proxy.spec.js: use Buffer.from() Buffer() is deprecated according to the warnings when running tests. --- spec/proxy.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/proxy.spec.js b/spec/proxy.spec.js index 57347c1..24cdd51 100644 --- a/spec/proxy.spec.js +++ b/spec/proxy.spec.js @@ -31,7 +31,7 @@ describe('proxy', function() { .send('boaty mcboatface') .expect(200) .expect(function() { - expect(fakeRequest.calls.argsFor(0)[0].body).toEqual(new Buffer('boaty mcboatface')); + expect(fakeRequest.calls.argsFor(0)[0].body).toEqual(Buffer.from('boaty mcboatface')); }) .end(assert(done)); }); From a3b1ece48a24b24977163fb18f91bb66f560f707 Mon Sep 17 00:00:00 2001 From: "Peter A. Jonsson" Date: Wed, 1 May 2024 19:20:08 +0200 Subject: [PATCH 2/2] proxy.spec.js: fix type of responseStatus This is required to be an int, so make it an int on construction. --- spec/proxy.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/proxy.spec.js b/spec/proxy.spec.js index 24cdd51..10ebff9 100644 --- a/spec/proxy.spec.js +++ b/spec/proxy.spec.js @@ -567,7 +567,7 @@ describe('proxy', function() { } function requestFake(req) { - const responseStatus = req.headers['x-give-response-status'] || 200; + const responseStatus = parseInt(req.headers['x-give-response-status']) || 200; var request = { on: function(event, cb) { if (event === 'response') {