Skip to content

refactor(http-clients)!: Move redirect and cookie handling into a shared HttpClient base class - #2349

Open
Mantisus wants to merge 1 commit into
apify:v2from
Mantisus:refactor-http-client
Open

Mantisus wants to merge 1 commit into
apify:v2from
Mantisus:refactor-http-client

Conversation

@Mantisus

@Mantisus Mantisus commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Description

HttpClient now has a single public method, send_request, which returns the response before its body is read. A client implements only _fetch, which sends one request. The base class follows redirects, sends and stores the session cookies on every hop, and drops credentials when a redirect leaves the origin, the same way for every client. crawl() and stream() are removed.

The timeout of send_request covers the redirect chain and reading the body, every client takes follow_redirects, and HttpResponse is an abstract base class that closes the response when used as an async context manager. The v2 upgrade guide describes what changes for existing code and custom clients.

Issues

@Mantisus Mantisus self-assigned this Oct 22, 2026
@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Oct 22, 2026
@Mantisus Mantisus changed the title refactor{http-clients}: Refactor HttpClient refactor(http-clients)!: Refactor HttpClient Oct 22, 2026
@Mantisus
Mantisus force-pushed the refactor-http-client branch 2 times, most recently from cb8b05a to c20c567 Compare October 24, 2026 16:22
@Mantisus
Mantisus marked this pull request as ready for review October 24, 2026 16:22
@Mantisus
Mantisus requested review from Pijukatel and vdusek and removed request for vdusek October 24, 2026 16:22
@Mantisus Mantisus changed the title refactor(http-clients)!: Refactor HttpClient refactor(http-clients)!: Move redirect and cookie handling into a shared HttpClient base class Oct 24, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants