From 6a78c2ad69982e7676436a8b10c2432277549906 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Thu, 21 Nov 2024 19:34:54 +0100 Subject: [PATCH] Apply suggestions from code review --- lib/handler/redirect-handler.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/handler/redirect-handler.js b/lib/handler/redirect-handler.js index e92fa66bab8..fefd4d979dc 100644 --- a/lib/handler/redirect-handler.js +++ b/lib/handler/redirect-handler.js @@ -137,7 +137,7 @@ class RedirectHandler { // In case of HTTP 301 or 302 with POST, change the method to GET if ((statusCode === 301 || statusCode === 302) && this.opts.method === 'POST') { this.opts.method = 'GET' - util.destroy(this.opts.body) + util.destroy(this.opts.body.on?.('error', () => {}) this.opts.body = null } @@ -145,7 +145,7 @@ class RedirectHandler { // In case of HTTP 303, always replace method to be either HEAD or GET if (statusCode === 303 && this.opts.method !== 'HEAD') { this.opts.method = 'GET' - util.destroy(this.opts.body) + util.destroy(this.opts.body.on?.('error', () => {})) this.opts.body = null } }