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