chore(fetcher): add referer to fetch logging

This commit is contained in:
WebStreamr 2025-09-28 20:15:15 +00:00
parent af5c3f2ae6
commit fcced2e122
No known key found for this signature in database

View file

@ -279,7 +279,17 @@ export class Fetcher {
protected async fetchWithTimeout(ctx: Context, url: URL, init?: CustomRequestInit, tryCount = 0): Promise<Response> {
const proxyUrl = getProxyForUrl(ctx, url);
this.logger.info(`Fetch ${init?.method ?? 'GET'} ${url} via proxy ${proxyUrl}`, ctx);
const headers = init?.headers as Record<string, string> | undefined;
let message = `Fetch ${init?.method ?? 'GET'} ${url}`;
/* istanbul ignore if */
if (headers && headers['Referer']) {
message += ' with referer ' + headers['Referer'];
}
/* istanbul ignore if */
if (proxyUrl) {
message += ' via proxy ' + proxyUrl;
}
this.logger.info(message, ctx);
const isRateLimitedRaw = await this.rateLimitedCache.getRaw<true>(url.host);
/* istanbul ignore if */