Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
};
const { charset, mediaType } = getContentTypeData(fetchEnd.element, fetchEnd.resource, fetchEnd.response.headers, fetchEnd.response.body.rawContent);
fetchEnd.response.mediaType = mediaType!;
fetchEnd.response.charset = charset!;
// Event is also emitted when status code in response is not 200.
await this.server.emitAsync(`fetch::end::${getType(mediaType!)}` as 'fetch::end::*', fetchEnd);
/*
* If the target is not an HTML we don't need to
* traverse it.
*/
/* istanbul ignore if */
if (!isHTMLDocument(this.finalHref, this.headers)) {
await this.server.emitAsync('scan::end', { resource: this.finalHref });
resolve();
return;
}
const virtualConsole = new VirtualConsole();
virtualConsole.on('error', (err: Error) => {
debug(`Console: ${err}`);
});
virtualConsole.on('jsdomError', (err) => {
debug(`Console: ${err}`);
});