Use URLSearchParams.toString instead of Query.buildString.

This commit is contained in:
David Fifield 2019-07-18 17:50:56 -06:00
parent fdc5563f87
commit e87ec65858
2 changed files with 2 additions and 20 deletions

View file

@ -1,5 +1,5 @@
/* global log */ /* global log */
/* exported Query, Params, DummyRateLimit */ /* exported Params, DummyRateLimit */
/* /*
A JavaScript WebRTC snowflake proxy A JavaScript WebRTC snowflake proxy
@ -50,22 +50,6 @@ Util.TBB_UAS = [
]; ];
class Query {
// params is a list of (key, value) 2-tuples.
static buildString(params) {
var i, len, param, parts;
parts = [];
for (i = 0, len = params.length; i < len; i++) {
param = params[i];
parts.push(encodeURIComponent(param[0]) + '=' + encodeURIComponent(param[1]));
}
return parts.join('&');
}
}
class Parse { class Parse {
// Parse a cookie data string (usually document.cookie). The return type is an // Parse a cookie data string (usually document.cookie). The return type is an

View file

@ -1,5 +1,3 @@
/* global Query */
/* /*
Only websocket-specific stuff. Only websocket-specific stuff.
*/ */
@ -36,7 +34,7 @@ class WS {
} }
if (void 0 !== params) { if (void 0 !== params) {
parts.push('?'); parts.push('?');
parts.push(Query.buildString(params)); parts.push(new URLSearchParams(params).toString());
} }
return parts.join(''); return parts.join('');
} }