From cfed36d65bfbdb85a802dc04fecdc48b74c2979a Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Thu, 14 May 2020 16:48:40 +0000 Subject: [PATCH] Cache: Change URL method to work with older nodejs versions git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@58699 d315682c-612b-4755-9ff5-7f18f6832af3 --- services/cache/mecache/cache.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/cache/mecache/cache.js b/services/cache/mecache/cache.js index 6313acf0..6fc10408 100644 --- a/services/cache/mecache/cache.js +++ b/services/cache/mecache/cache.js @@ -5,6 +5,7 @@ let app = express(); let mcache = require('memory-cache'); const request = require('superagent'); const prom = require('prom-client'); +const URL = require('url'); let cors = require('cors'); app.use(cors()); @@ -38,7 +39,7 @@ let cache = (duration) => { if(req.query.url) { let key = '__express__' + req.query.url; let cachedBody = mcache.get(key); - const url = new URL(req.query.url); + const url = new URL.parse(req.query.url); const target = url.host + '/' + url.pathname.split('/')[1]; const scheme = url.protocol.replace(':', ''); if (cachedBody) {