fix(xo-lib): handle URLs ending with /
Thanks @rushikeshjadhav
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user