INNER CODE UNIT · JavaScript

preHook

cyrus-and/chrome-har-capturer · bin/cli.js:59

async function preHook(url, client) {
    const {Network, Security} = client;
    // optionally ignore certificate errors
    if (program.insecure) {
        await Security.enable();
        await Security.setOverrideCertificateErrors({override: true});
        Security.certificateError(({eventId}) => {
            Security.handleCertificateError({eventId, action: 'continue'});
        });
    }
    // optionally set user agent
    const userAgent = program.agent;
    if (typeof userAgent === 'string') {
        await Network.setUserAgentOverride({userAgent});
    }
    // optionally block URLs
    if (program.block) {
        await Network.setBlockedURLs({urls: program.block});

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…