diff --git a/js/packages/binderhub-client/lib/index.js b/js/packages/binderhub-client/lib/index.js index 19d239304..2cd2a7d21 100644 --- a/js/packages/binderhub-client/lib/index.js +++ b/js/packages/binderhub-client/lib/index.js @@ -25,11 +25,14 @@ export class BinderRepository { * Call the BinderHub API */ fetch() { - let apiUrl = this.baseUrl + "build/" + this.providerSpec; + let apiUrl = new URL(this.baseUrl + "build/" + this.providerSpec); + let params = new URLSearchParams(); if (this.buildToken) { - apiUrl = apiUrl + `?build_token=${this.buildToken}`; + params.append('build_token', this.buildToken); } + apiUrl.search = params.toString(); + this.eventSource = new EventSource(apiUrl); this.eventSource.onerror = (err) => { console.error("Failed to construct event stream", err);