From fc3339142b87b12113d0ea911e1bc74415dbd0eb Mon Sep 17 00:00:00 2001 From: Jack Franklin Date: Mon, 20 Apr 2020 17:15:54 +0100 Subject: [PATCH] Fix params being required --- src/Connection.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Connection.ts b/src/Connection.ts index cf9b2e9bb1b12..2e42e93a47609 100644 --- a/src/Connection.ts +++ b/src/Connection.ts @@ -177,7 +177,13 @@ export class CDPSession extends EventEmitter { send(method: T, params?: Protocol.CommandParameters[T]): Promise { if (!this._connection) return Promise.reject(new Error(`Protocol error (${method}): Session closed. Most likely the ${this._targetType} has been closed.`)); - const id = this._connection._rawSend({sessionId: this._sessionId, method, params}); + + const id = this._connection._rawSend({ + sessionId: this._sessionId, + method, + params: params || {} + }); + return new Promise((resolve, reject) => { this._callbacks.set(id, {resolve, reject, error: new Error(), method}); });