CachingMiddleware: Switch to ES6 class syntax

pull/4882/head
Richard Hansen 2021-02-26 19:39:28 -05:00 committed by webzwo0i
parent 80af66543a
commit 0284d49522
1 changed files with 4 additions and 10 deletions

View File

@ -77,10 +77,8 @@ if (_crypto) {
should replace this. should replace this.
*/ */
function CachingMiddleware() { module.exports = class CachingMiddleware {
} handle(req, res, next) {
CachingMiddleware.prototype = new function () {
const handle = (req, res, next) => {
if (!(req.method === 'GET' || req.method === 'HEAD') || !CACHE_DIR) { if (!(req.method === 'GET' || req.method === 'HEAD') || !CACHE_DIR) {
return next(undefined, req, res); return next(undefined, req, res);
} }
@ -214,9 +212,5 @@ CachingMiddleware.prototype = new function () {
next(undefined, req, res); next(undefined, req, res);
}); });
}; }
};
this.handle = handle;
}();
module.exports = CachingMiddleware;