From: Chris Hofstaedtler Date: Tue, 16 Aug 2022 10:12:52 +0000 (+0200) Subject: rec js: use searchParams.append to build URL X-Git-Tag: rec-4.8.0-alpha1~65^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=633050dc4ab3937b9fc60049396e79f5420e616c;p=thirdparty%2Fpdns.git rec js: use searchParams.append to build URL --- 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',