From 633050dc4ab3937b9fc60049396e79f5420e616c Mon Sep 17 00:00:00 2001 From: Chris Hofstaedtler Date: Tue, 16 Aug 2022 12:12:52 +0200 Subject: [PATCH] rec js: use searchParams.append to build URL --- pdns/recursordist/html/local-2022.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pdns/recursordist/html/local-2022.js b/pdns/recursordist/html/local-2022.js index 3e653c9598..122a8ac5b9 100644 --- a/pdns/recursordist/html/local-2022.js +++ b/pdns/recursordist/html/local-2022.js @@ -17,7 +17,12 @@ const fetchConfig = { var gdata = {}; function get_json(url, params) { - const realURL = new URL(url + '?' + (new URLSearchParams(params)).toString(), fetchConfig.baseURL); + const realURL = new URL(url, fetchConfig.baseURL); + if (params) { + for (const [k, v] of Object.entries(params)) { + realURL.searchParams.append(k, v); + } + } return new Promise((resolve, reject) => { fetch(realURL, { method: 'GET', -- 2.47.2