diff --git a/packages/xo-lib/src/index.js b/packages/xo-lib/src/index.js index 9c37dd906..c3ab7555e 100644 --- a/packages/xo-lib/src/index.js +++ b/packages/xo-lib/src/index.js @@ -1,4 +1,5 @@ import JsonRpcWebSocketClient, { OPEN, CLOSED } from 'jsonrpc-websocket-client' +import trimEnd from 'lodash/trimEnd' import { BaseError } from 'make-error' // =================================================================== @@ -14,7 +15,7 @@ export class XoError extends BaseError {} export default class Xo extends JsonRpcWebSocketClient { constructor(opts) { const url = opts != null ? opts.url : '.' - super(`${url === '/' ? '' : url}/api/`) + super(`${trimEnd(url, '/')}/api/`) this._credentials = opts != null ? opts.credentials : null this._user = null