Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
}
} else if (res.body && !expectBinary) {
parsedBody = res.body.toString('utf-8');
} else {
parsedBody = res.body;
}
if (
parsedBody &&
parsedBody.hasOwnProperty('error') &&
parsedBody.hasOwnProperty('code') &&
parsedBody.hasOwnProperty('errorMessage') &&
parsedBody.hasOwnProperty('errorNum')
) {
res.body = parsedBody;
reject(new ArangoError(res));
} else if (res.statusCode && res.statusCode >= 400) {
res.body = parsedBody;
reject(new HttpError(res));
} else {
if (!expectBinary) {
res.body = parsedBody;
}
resolve(getter ? getter(res) : (res as any));
}
}
};