-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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] route handler to support redirects #3993
Comments
I added a test for this in #3994 It looks like a new |
As pointed in #3994, this is currently by design. Let me update this as a feature request. |
@dgozman thanks. Is there a way of providing an allow list on urls that can be accessed (including redirects) and block the rest without needing to intercept? |
There is no specific API for this. I think you can use proxy, although that's involved. |
Looks like that could work by not setting up a server and using
Any tips on how we could support this? Sounds like something browsers would need to support first before playwright could hook into it? |
Exactly. This is specific to each browser's network stack, and requires investigation. Given the effort vs relatively small usecase, I don't expect this to be implemented in the near future. |
Closing it for now as per above... |
With the growing popularity of Remix (especially with the acquisition by Shopify), the use case for handling redirects is growing. Redirecting is a common pattern in Remix. Consider reopening, and finding a solution. |
I'd suggest that not doing this is broken from the perspective of doing OAuth mocking too. If you have a page in your site that should trigger the OAuth process, then that needs to redirect to the OAuth server. However, it's impossible to do this using Playwright at this stage. Please reconsider this issue - I can see the request using |
4 years later, no workaround or solution...? |
I actually came up with a workaround for this (and a related bug in the WebKit Playwright implementation), where instead of returning a redirect, you instead return a 200 (or whatever status code you like), and manually handle the redirect(s) in your test. It's far less than ideal (I think I spent around 15 lines of code, specific to the test case, and another 10+ lines of comment), but at least it works. |
Mind sharing your solution? |
I also need this feature in order to implement auto-selecting certificate |
Context:
Code Snippet
Describe the bug
When clicking 'sign in' there is a 302 redirect from
https://session.bbc.co.uk/session
tohttps://account.bbc.com/
.It looks like the handler is not called again with the new url on the redirect.
The docs say:
So I'm expecting the handler to be called again with the new url.
I'm expecting "Did not see request" not to be logged in my example, but it is.
The text was updated successfully, but these errors were encountered: