From b041f9a7548d04eb816cdf36690d8f2b6866d25e Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Wed, 16 Nov 2022 18:06:00 -0500 Subject: [PATCH] perf: simplify isValidHeaderName (#1772) --- lib/fetch/util.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/fetch/util.js b/lib/fetch/util.js index 4a03ad2af59..4d21e2e17b9 100644 --- a/lib/fetch/util.js +++ b/lib/fetch/util.js @@ -146,13 +146,7 @@ function isValidHeaderName (potentialValue) { return false } - for (const char of potentialValue) { - if (!isValidHTTPToken(char)) { - return false - } - } - - return true + return isValidHTTPToken(potentialValue) } /**