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

Add support for retrieving all cookies, not just one cookie by name #770

Open
bkosborne opened this issue Nov 5, 2018 · 0 comments
Open

Comments

@bkosborne
Copy link

bkosborne commented Nov 5, 2018

The DriverInterface currently has method getCookie($name) {}, but it lacks getCookies(). This would be helpful in cases where the name of the cookie needed is not known.

I understand this would be a BC break, so I think it would have to be in version 2.0.0. I believe most drivers support such a method of cookie retrieval. Goutte/Chrome certainly do.

My use case:

I'm trying to write a behat test for a Drupal 8 site and in one of my step definitions, I need to make a separate request via Guzzle to the Drupal site using the same session that exists within the driver. Specifically, I'm writing a test that downloads a file from the site to verify that it could do that successfully. It doesn't seem possible to do that properly by using the driver directly, so I'm trying to use Guzzle to download the file. I need to copy the session cookies from the driver to the Guzzle request. The problem is that Drupal uses a special hash as the name of the cookie. I can reproduce the calculation to create the hash, but it makes my tests a bit brittle.

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

1 participant