diff --git a/test/js-mocha-specs.js b/test/js-mocha-specs.js index 335fa76..8ef7ce7 100644 --- a/test/js-mocha-specs.js +++ b/test/js-mocha-specs.js @@ -191,9 +191,9 @@ describe('URL util', function () { it('serializes query params correctly with URL encoding enabled', () => { util.serializeQueryParams({ - param1: 'value with spaces', - param2: 'value with special character äöü%&' - }, true).should.equal('param1=value%20with%20spaces¶m2=value%20with%20special%20character%20%C3%A4%C3%B6%C3%BC%25%26'); + 'param 1': 'value with spaces', + 'param 2': 'value with special character äöü%&' + }, true).should.equal('param%201=value%20with%20spaces¶m%202=value%20with%20special%20character%20%C3%A4%C3%B6%C3%BC%25%26'); }); it('serializes array of query params correctly', () => { diff --git a/www/url-util.js b/www/url-util.js index f05831c..802af01 100644 --- a/www/url-util.js +++ b/www/url-util.js @@ -82,7 +82,7 @@ module.exports = function init(helpers) { function serializeIdentifier(parentKey, key, encode) { if (!parentKey.length) { - return key; + return encode ? encodeURIComponent(key) : key; } if (encode) {