You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b5f2f2e
Browse filesBrowse the repository at this point in the historyBrowse files
feat(http-clients)!: Merge a Cookie header with stored cookies (#2385)
### Description
A `Cookie` header passed with a request or set on the client is now
merged with the session cookies, with every HTTP client and in
`context.send_request` of `PlaywrightCrawler`. A cookie in the header
wins over a session cookie of the same name and isn't stored in the
session. An empty `Cookie` header no longer keeps the session cookies
out. The v2 upgrade guide describes the change.
### Issues
- Part of: #2307
- Follow-up: #2349
*✍️ Drafted by Claude Code*
Co-authored-by: Vlada Dusek <v.dusek96@gmail.com>
Copy file name to clipboardExpand all lines: docs/06_upgrading/upgrading_to_v2.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -383,6 +383,12 @@ The crawlers pass the remaining `navigation_timeout` to the HTTP client, so it b
383
383
384
384
The `headers` argument of a client still applies to every request. Its `Authorization`, `Proxy-Authorization` and `Cookie` headers are dropped when a redirect leaves the origin, the same as the headers passed with a request. With `HttpxHttpClient`, the headers of the client now win over the generated browser headers. In v1, the generated browser headers replaced them.
385
385
386
+
### A `Cookie` header is merged with the session cookies
387
+
388
+
A `Cookie` header passed with a request or set on the client is merged with the session cookies while the redirect chain stays on its origin. A cookie in the header wins over a session cookie of the same name and isn't stored in the session. In v1, `ImpitHttpClient`, `HttpxHttpClient` and `context.send_request` of `PlaywrightCrawler` sent the header instead of the session cookies, so an empty `Cookie` header kept them out. `CurlImpersonateHttpClient` sent the session cookies in a second `Cookie` header.
389
+
390
+
Without a session, or with `persist_cookies_per_session=False`, the cookies a server sets during a redirect chain are sent with the following requests of that chain. In v1, `ImpitHttpClient` and `HttpxHttpClient` didn't send them.
391
+
386
392
### Some client arguments are ignored
387
393
388
394
The following keyword arguments of the underlying libraries are now ignored with a warning:
0 commit comments