From f306f6482970aa23f74d9b427aa806676bb02433 Mon Sep 17 00:00:00 2001 From: Ayoub-Mabrouk Date: Mon, 4 Nov 2024 02:26:46 +0100 Subject: [PATCH] Refactor: simplify req.acceptsEncodings with spread syntax Replaced use of `arguments` in `req.acceptsEncodings` with the spread syntax (`...encodings`) to improve readability and reduce code complexity, while maintaining the same functionality. --- lib/request.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/request.js b/lib/request.js index 372a9915e9..e30e2625e5 100644 --- a/lib/request.js +++ b/lib/request.js @@ -141,9 +141,8 @@ req.accepts = function(){ * @public */ -req.acceptsEncodings = function(){ - var accept = accepts(this); - return accept.encodings.apply(accept, arguments); +req.acceptsEncodings = function(...encodings) { + return accepts(this).encodings(...encodings); }; /**