From de3a8682b64bdafa9cece7e53784d92e29ad7d83 Mon Sep 17 00:00:00 2001 From: Dardan Bujupaj Date: Mon, 18 Mar 2024 12:22:12 +0100 Subject: [PATCH] fix lint errors --- src/crawler.ts | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/crawler.ts b/src/crawler.ts index 8d10f80..ff39441 100644 --- a/src/crawler.ts +++ b/src/crawler.ts @@ -51,8 +51,8 @@ export class Crawler { this.config.strategy == 'docssearch' ? new DocsearchScraper(this.sender, this.config) : this.config.strategy == 'schema' - ? new SchemaScraper(this.sender, this.config) - : new DefaultScraper(this.sender, this.config) + ? new SchemaScraper(this.sender, this.config) + : new DefaultScraper(this.sender, this.config) } async run() { @@ -63,22 +63,26 @@ export class Crawler { //Create the router const router = createPuppeteerRouter() - // type DefaultHandler = Parameters[0]; router.addDefaultHandler(this.defaultHandler.bind(this)) - const preNavigationHooks: PuppeteerHook[] = this.config.additional_request_headers ? [ - async (crawlingContext) => { - crawlingContext.addInterceptRequestHandler(async (request) => { - request.continue({ - headers: { - ...request.headers(), - ...this.config.additional_request_headers, - } - }); - }) - }, - ] : [] + const preNavigationHooks: PuppeteerHook[] = this.config + .additional_request_headers + ? [ + async (crawlingContext) => { + await crawlingContext.addInterceptRequestHandler( + async (request) => { + return await request.continue({ + headers: { + ...request.headers(), + ...this.config.additional_request_headers, + }, + }) + } + ) + }, + ] + : [] const puppeteerCrawlerOptions: PuppeteerCrawlerOptions = { requestQueue,