fix(xen-api/_call): ensure args always defined

Otherwise it might cause JSON-RPC issue on some XAPI versions (missing `params` field) or problems when augmenting errors with `call.params` (*TypeError: Cannot read properties of undefined (reading '0')*).
This commit is contained in:
Julien Fontanet
2023-03-06 14:30:36 +01:00
parent 58e4f9b7b4
commit e3d9a7ddf2

View File

@@ -728,7 +728,7 @@ export class Xapi extends EventEmitter {
// Private
// ===========================================================================
async _call(method, args, timeout = this._callTimeout(method, args)) {
async _call(method, args = [], timeout = this._callTimeout(method, args)) {
const startTime = Date.now()
try {
const result = await pTimeout.call(this._addSyncStackTrace(this._transport(method, args)), timeout)