Skip to content

Commit 326ae91

Browse files
committed
fix(testing): sync shared tool-tester mock headers with new defaults
createMockHeaders in the shared @sim/testing tool-tester builder still hardcoded the old Chrome UA / Referer / Sec-Ch-Ua fallback values. It was unreachable in current tests but would silently diverge from production getDefaultHeaders() for any future test hitting its fallback path.
1 parent a0449b6 commit 326ae91

2 files changed

Lines changed: 5 additions & 9 deletions

File tree

apps/sim/tools/http/utils.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import type { TableRow } from '@/tools/types'
44
/**
55
* Creates a set of default headers used in HTTP requests.
66
*
7-
* Identifies as Sim rather than impersonating a browser — browser-fingerprint
7+
* Identifies as Sim rather than impersonating a browser. Browser-fingerprint
88
* headers (Referer, Sec-Ch-Ua*) trip anti-CSRF/bot-defense heuristics on
9-
* providers like Atlassian, which explicitly reject REST calls carrying a
10-
* browser User-Agent. See https://support.atlassian.com/jira/kb/rest-api-calls-with-a-browser-user-agent-header-may-fail-csrf-checks/
9+
* providers like Atlassian, which reject REST calls carrying a browser
10+
* User-Agent regardless of X-Atlassian-Token. See
11+
* https://support.atlassian.com/jira/kb/rest-api-calls-with-a-browser-user-agent-header-may-fail-csrf-checks/
1112
* @param customHeaders Additional user-provided headers to include
1213
* @param url Target URL for the request (used for setting Host header)
1314
* @returns Record of HTTP headers

packages/testing/src/builders/tool-tester.builder.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,11 @@ export interface ToolResponse {
4343
*/
4444
const createMockHeaders = (customHeaders: Record<string, string> = {}) => {
4545
return {
46-
'User-Agent':
47-
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36',
46+
'User-Agent': 'Sim/1.0 (+https://sim.ai)',
4847
Accept: '*/*',
4948
'Accept-Encoding': 'gzip, deflate, br',
5049
'Cache-Control': 'no-cache',
5150
Connection: 'keep-alive',
52-
Referer: 'https://www.sim.ai',
53-
'Sec-Ch-Ua': 'Chromium;v=91, Not-A.Brand;v=99',
54-
'Sec-Ch-Ua-Mobile': '?0',
55-
'Sec-Ch-Ua-Platform': '"macOS"',
5651
...customHeaders,
5752
}
5853
}

0 commit comments

Comments
 (0)