From 07ddaab7fb8a8818d6e0f60ee4d701430bd28178 Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Thu, 29 May 2025 17:55:20 +0000 Subject: [PATCH] chore(fetcher): set more headers to mimick browser requests --- src/utils/Fetcher.test.ts | 5 ++++- src/utils/Fetcher.ts | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils/Fetcher.test.ts b/src/utils/Fetcher.test.ts index 04af0a5..0cd7c25 100644 --- a/src/utils/Fetcher.test.ts +++ b/src/utils/Fetcher.test.ts @@ -26,10 +26,13 @@ describe('fetch', () => { 'https://some-url.test/', { headers: { + 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', + 'Accept-Language': 'en', 'Forwarded': 'for=127.0.0.1', 'Origin': 'https://some-url.test', - 'User-Agent': expect.not.stringMatching(/jest/), + 'Priority': 'u=0', 'Referer': 'https://some-url.test', + 'User-Agent': expect.not.stringMatching(/jest/), 'X-Forwarded-For': '127.0.0.1', 'X-Forwarded-Proto': 'https', 'X-Real-IP': '127.0.0.1', diff --git a/src/utils/Fetcher.ts b/src/utils/Fetcher.ts index 43ae271..b73429c 100644 --- a/src/utils/Fetcher.ts +++ b/src/utils/Fetcher.ts @@ -43,8 +43,11 @@ export class Fetcher { timeout: 15000, ...config, headers: { + 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', + 'Accept-Language': 'en', 'Forwarded': `for=${ctx.ip}`, 'Origin': `${origin}`, + 'Priority': 'u=0', 'Referer': `${referer}`, 'User-Agent': this.createUserAgentForIp(ctx.ip), 'X-Forwarded-For': ctx.ip,