Merge pull request #4168 from Icinga/fix/null-values-in-query-params-4167

js: Properly parse/build url query values
This commit is contained in:
Johannes Meyer 2020-06-08 08:29:58 +02:00 committed by GitHub
commit 001798b9d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 3 deletions

View File

@ -204,7 +204,16 @@
} }
query += params[i].key; query += params[i].key;
if (params[i].value !== null) { switch (params[i].value) {
case true:
break;
case false:
query += '=0';
break;
case null:
query += '=';
break;
default:
query += '=' + params[i].value; query += '=' + params[i].value;
} }
} }
@ -235,7 +244,7 @@
value = segment[i].slice(equalPos + 1); value = segment[i].slice(equalPos + 1);
} else { } else {
key = segment[i]; key = segment[i];
value = null; value = true;
} }
params.push({ key: key, value: value }); params.push({ key: key, value: value });