Skip to content

feat: provide Request instances in skipped request callbacks#1927

Open
lorenz-lb wants to merge 1 commit into
apify:masterfrom
lorenz-lb:master
Open

feat: provide Request instances in skipped request callbacks#1927
lorenz-lb wants to merge 1 commit into
apify:masterfrom
lorenz-lb:master

Conversation

@lorenz-lb
Copy link
Copy Markdown

Description

This PR changes the skipped request handler to receive a Request object instead of only the URL str.

Skipped URLs are now converted into Request objects before the callback is invoked. This ensures that request metadata remains available for skipped requests, including request.user_data and other request attributes.

Issues

  • N/A

Testing

  • Added/updated unit tests for skipped request handlers.
  • Verified that skipped request handlers receive the original Request object.
  • Ran uv run poe check-code.

Checklist

  • CI passed

Future improvements

While working on this change, I noticed that many parts of the internal processing pipeline operate on str | Request unions.

A possible future improvement could be to standardize on Request objects internally and only accept str | Request at the public API boundary. URLs could then be wrapped into Request instances immediately, allowing the rest of the codebase to operate exclusively on Request objects.

This could simplify typing, reduce repeated union handling, and make request metadata consistently available throughout the pipeline. However, such a change would require broader refactoring and additional testing, so it is outside the scope of this PR.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants