Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Add a config to routeFromHAR to control whether to strick check between the real url and the url in HAR file #34171

Closed
ChenChenyaqi opened this issue Dec 30, 2024 · 1 comment

Comments

@ChenChenyaqi
Copy link

🚀 Feature Request

Hello, when I used the routeFromHAR method to record a specific URL in the project today, I found that after the recording was completed, when replaying from the HAR file, the real URL requested by the browser could never find a corresponding record in the HAR file.

Example

This is my URL/user/foo/bar?t=173845678126. Among them, 173845678126 is a random number. It is generated randomly every time the page is entered and used as a query parameter for this interface. This will cause the request URL initiated from the browser to not find a corresponding record in the HAR file, because the values of their 't' parameters are different.
My temporary solution is to use the patch-package library to patch the relevant code in playwright-core.
Here is my patch:
Image
It mainly removes the === strict check for whether the URLs are exactly the same, and instead checks whether the part before the '?' is the same.

Motivation

I hope the routeFromHAR method can support passing a parameter, for example, named strictCheck with a default value of true. However, users should be allowed to configure it as false to ignore the query parameters after the '?' and only compare whether the part of the URL before the '?' is the same. If they are the same, the response will be directly read from the HAR file.
Furthermore, perhaps it would be possible to support setting this parameter for a specific specified URL.

@yury-s
Copy link
Member

yury-s commented Dec 30, 2024

Folding into #21405, please upvote that request instead.

@yury-s yury-s closed this as completed Dec 30, 2024
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

No branches or pull requests

2 participants