Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ const DEFAULT_OPTIONS: TlsClientDefaultOptions = {
'accept-datetime',
],
defaultHeaders: {
'User-Agent':
'user-agent':
Comment thread
coderabbitai[bot] marked this conversation as resolved.
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36',
},
connectHeaders: null,
Expand Down Expand Up @@ -562,6 +562,15 @@ export class SessionClient {
throw new Error('ModuleClient must be an instance of ModuleClient');
}

const allHeaders = [...Object.keys(options.defaultHeaders ?? {}), ...Object.keys(options.connectHeaders ?? {})]
if (options.forceHttp1 !== true) {
for (const header of allHeaders) {
if (header !== header.toLowerCase()) {
throw new Error(`HTTP/2 header must be lowercase for fingerprint consistency: ${header}`);
}
}
}

Comment thread
coderabbitai[bot] marked this conversation as resolved.
// Copy nested mutables so one session's edits never bleed into another
this.defaultOptions = {
...DEFAULT_OPTIONS,
Expand Down