Skip to content

Comments

fix: correctly set cookies#185

Merged
steve8708 merged 2 commits intoBuilderIO:mainfrom
ZephyrZenn:main
Jan 23, 2025
Merged

fix: correctly set cookies#185
steve8708 merged 2 commits intoBuilderIO:mainfrom
ZephyrZenn:main

Conversation

@ZephyrZenn
Copy link
Contributor

@ZephyrZenn ZephyrZenn commented Jan 15, 2025

PR Description

Summary

This pull request introduces the changes to crawl function. This fix the problem that crawler can't get cookies correctly.

Changes Made

  1. Update PlaywrightCrawler.preNavigationHooks in crawl function(core.ts)
    • setting cookies before return if RESOURCE_EXCLUSIONS is empty. Otherwise cookies won't be set if no url excluded.
    • Use request.url instead of request.loadedUrl as cookie's url. Crawler hasn't naviagetd to the page when the hook invoked, so the loadedUrl would always be undefined.

Impact

Crawler can use cookies correctly when there is no excluded urls.

@steve8708
Copy link
Contributor

thanks @ZephyrZenn !

@steve8708 steve8708 merged commit 50f85a3 into BuilderIO:main Jan 23, 2025
5 checks passed
@github-actions
Copy link

🎉 This PR is included in version 1.5.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants