symfony/symfony — Issue #3385: [BrowserKit] on followRedirect, client omits cookies set in the RedirectResponse
Author: robocoder
Created: 2012-02-16 20:22:21+00:00
State: open

This behaviour appears to be different from a real browser.

Sf2.0.9

In my functional test, I have something like the following:

```php
$client = static::createClient();
$crawler = $client->request('GET', '/login_check'); // expect a redirect because this is POST only
$this->assertEquals(302, $client->getResponse()->getStatusCode());

// debug
ob_end_flush();
echo $client->getRequest()->__toString()."\n";
echo $client->getResponse()->__toString()."\n";
ob_start();

$crawler = $client->followRedirect();

//debug
ob_end_flush();
echo $client->getRequest()->__toString()."\n";
echo $client->getResponse()->__toString()."\n";
ob_start();

$this->assertTrue($crawler->filter('html:contains("Unable to find the controller for path")')->count() > 0);
```

The 302 response Set-Cookie lines not present in the first request, and the subsequent request has no cookies in the header.