Commit df44276
d 🔹
fix(playwright): honor user-agent from request headers (firecrawl#3387)
When scrape requests include a user-agent in the headers object, the
value was silently ignored because Playwright's context-level userAgent
(set from the UserAgent package) takes precedence over headers set via
page.setExtraHTTPHeaders().
Fix: extract user-agent from request headers (case-insensitive) and
pass it to createContext() as userAgentOverride, which replaces the
randomly-generated UserAgent when present. The user-agent key is then
filtered out of setExtraHTTPHeaders to avoid redundancy.
When no user-agent header is provided, behavior is unchanged: a random
user-agent is generated as before.
Fixes firecrawl#28021 parent 85f221f commit df44276
1 file changed
Lines changed: 18 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | | - | |
201 | | - | |
| 200 | + | |
| 201 | + | |
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| |||
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
404 | | - | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
405 | 412 | | |
406 | 413 | | |
407 | 414 | | |
408 | 415 | | |
409 | 416 | | |
410 | | - | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
411 | 425 | | |
412 | 426 | | |
413 | 427 | | |
| |||
0 commit comments