Skip to content

Commit 82d9f73

Browse files
committed
fix: headers list to lowercase
1 parent 6bca0d9 commit 82d9f73

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

src/codegen/codegen.utils.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
1-
import { canonicalHeaderKey } from '@/rules/utils'
21
import { ProxyData, RequestSnippetSchema } from '@/types'
32
import { getLocationHeader, getUpgradeHeader } from '@/utils/headers'
43

54
const HEADERS_TO_EXCLUDE = [
65
// Managed by k6 automatically
7-
'Cookie',
8-
'User-Agent',
9-
'Host',
10-
'Content-Length',
6+
'cookie',
7+
'user-agent',
8+
'host',
9+
'content-length',
1110

1211
// Transport/connection
13-
'Connection',
14-
'Accept-Encoding',
15-
'Te',
16-
'Transfer-Encoding',
12+
'connection',
13+
'accept-encoding',
14+
'te',
15+
'transfer-encoding',
1716

1817
// Browser cache (k6 has no cache)
19-
'Cache-Control',
20-
'Pragma',
18+
'cache-control',
19+
'pragma',
2120

2221
// Browser-specific behavior
23-
'Upgrade-Insecure-Requests',
24-
'Dnt',
25-
'Priority',
22+
'upgrade-insecure-requests',
23+
'dnt',
24+
'priority',
2625

2726
// Browser preferences
28-
'Accept-Language',
27+
'accept-language',
2928
]
3029

3130
// Browser security metadata headers — prefix match covers all
@@ -176,7 +175,7 @@ export function shouldIncludeHeaderInScript(key: string) {
176175
if (HEADER_PREFIXES_TO_EXCLUDE.some((prefix) => lower.startsWith(prefix))) {
177176
return false
178177
}
179-
return !HEADERS_TO_EXCLUDE.includes(canonicalHeaderKey(key))
178+
return !HEADERS_TO_EXCLUDE.includes(lower)
180179
}
181180

182181
export function generateScriptHeader() {

0 commit comments

Comments
 (0)