How to use the arangojs/lib/async/util/btoa.btoa function in arangojs

To help you get started, we’ve selected a few arangojs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AEB-labs / cruddl / src / database / arangodb / arangojs-instrumentation / custom-request.ts View on Github external
? 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:'
                )}`;
            }
            const options: ClientRequestArgs = { path, method, headers, agent };
            if (socketPath) {
                options.socketPath = socketPath;
            } else {
                options.host = baseUrlParts.hostname;
                options.port = baseUrlParts.port;
            }
            let called = false;
            try {
                const req = (isTls ? httpsRequest : httpRequest)(
                    options,
                    (res: IncomingMessage) => {
                        notifyAboutPhaseEnd(requestInstrumentation, 'waiting');