From fcced2e12274beeea498b8a42cda1c6a0952f6b1 Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Sun, 28 Sep 2025 20:15:15 +0000 Subject: [PATCH] chore(fetcher): add referer to fetch logging --- src/utils/Fetcher.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/utils/Fetcher.ts b/src/utils/Fetcher.ts index 560d99d..f28790a 100644 --- a/src/utils/Fetcher.ts +++ b/src/utils/Fetcher.ts @@ -279,7 +279,17 @@ export class Fetcher { protected async fetchWithTimeout(ctx: Context, url: URL, init?: CustomRequestInit, tryCount = 0): Promise { const proxyUrl = getProxyForUrl(ctx, url); - this.logger.info(`Fetch ${init?.method ?? 'GET'} ${url} via proxy ${proxyUrl}`, ctx); + const headers = init?.headers as Record | 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(url.host); /* istanbul ignore if */