-
Notifications
You must be signed in to change notification settings - Fork 3.6k
fix(headless): merge extra headers #6376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,6 +61,10 @@ func (i *Instance) Run(ctx *contextargs.Context, actions []*Action, payloads map | |
| } | ||
| page = page.Timeout(options.Timeout) | ||
|
|
||
| if err = i.browser.applyDefaultHeaders(page); err != nil { | ||
| return nil, nil, err | ||
| } | ||
|
|
||
|
Comment on lines
+64
to
+67
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainGood placement; ensure Accept-Language still applies with no custom headers. Calling applyDefaultHeaders right after setting Timeout is correct. With the current engine implementation, Accept-Language won’t be set if defaultHeaders is empty (regression). Please merge the engine.go fix to always apply Accept-Language unless the user provided one. To confirm coverage and avoid missed call sites: 🏁 Script executed: #!/bin/bash
# Find all Page creations and check that default headers are applied.
rg -n 'Page\s*\(\s*proto\.TargetCreateTarget' -A2
rg -n 'SetExtraHeaders\s*\(' -A2Length of output: 487 All page creation sites covered; merge Accept-Language fix The placement of Key locations checked:
Action required:
🤖 Prompt for AI Agents |
||
| if i.browser.customAgent != "" { | ||
| if userAgentErr := page.SetUserAgent(&proto.NetworkSetUserAgentOverride{UserAgent: i.browser.customAgent}); userAgentErr != nil { | ||
| return nil, nil, userAgentErr | ||
|
|
@@ -130,10 +134,6 @@ func (i *Instance) Run(ctx *contextargs.Context, actions []*Action, payloads map | |
| return nil, nil, err | ||
| } | ||
|
|
||
| if _, err := page.SetExtraHeaders([]string{"Accept-Language", "en, en-GB, en-us;"}); err != nil { | ||
| return nil, nil, err | ||
| } | ||
|
|
||
| // inject cookies | ||
| // each http request is performed via the native go http client | ||
| // we first inject the shared cookies | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.