Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{ method, url, headers, body, requestInstrumentation }: RequestOptions,
callback: Errback
) {
// this is the last change we cancel a request
// we don't cancel running requests because arangodb does not kill queries when the request ist terminated
// thus, we keep the request open
// - to get notified if the request completes pretty quickly anyway so we don't need to kill the query
// - to take up a socket so that no new query is sent on it while the query is not yet killed
if (requestInstrumentation && requestInstrumentation.isCancelled) {
return callback(new Error(`Request has been cancelled by caller before it was sent`));
}
notifyAboutPhaseEnd(requestInstrumentation, 'queuing');
let path = baseUrlParts.pathname
? url.pathname
? joinPath(baseUrlParts.pathname, url.pathname)
: baseUrlParts.pathname
: url.pathname;
const search = url.search
? baseUrlParts.search
? `${baseUrlParts.search}&${url.search.slice(1)}`
: url.search
: baseUrlParts.search;
if (search) {
path += search;
}
if (body && !headers['content-length']) {
headers['content-length'] = String(Buffer.byteLength(body));
}
if (!headers['authorization']) {
headers['authorization'] = `Basic ${btoa(
baseUrlParts.auth || 'root:'