From 0284d49522f4cb97d6c79016e6b6c27fa8fafd58 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Fri, 26 Feb 2021 19:39:28 -0500 Subject: [PATCH] CachingMiddleware: Switch to ES6 class syntax --- src/node/utils/caching_middleware.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/node/utils/caching_middleware.js b/src/node/utils/caching_middleware.js index 7472607ff..d5d3de4fe 100644 --- a/src/node/utils/caching_middleware.js +++ b/src/node/utils/caching_middleware.js @@ -77,10 +77,8 @@ if (_crypto) { should replace this. */ -function CachingMiddleware() { -} -CachingMiddleware.prototype = new function () { - const handle = (req, res, next) => { +module.exports = class CachingMiddleware { + handle(req, res, next) { if (!(req.method === 'GET' || req.method === 'HEAD') || !CACHE_DIR) { return next(undefined, req, res); } @@ -214,9 +212,5 @@ CachingMiddleware.prototype = new function () { next(undefined, req, res); }); - }; - - this.handle = handle; -}(); - -module.exports = CachingMiddleware; + } +};