Why CookieJar is emptied between two request with Behatch extension?

Viewed 98

For my work, i use the behatch context extension in order to test my api.

With a massive update of my library, i encountered a strange behavior. Imagine that i send two request (for exemple a POST and a GET) then i lost cookies between them.

I dumped the cookie jar in this exemple :

    When I send a "POST" request to "/rest/contacts" with body: # Behatch\Context\RestContext::iSendARequestToWithBody()
      """
      {
      "name": "toto",
      "mail": "titi@toto.com"
      }
      """
      │ vendor/fabpot/goutte/Goutte/Client.php:128:
      │ class Symfony\Component\BrowserKit\CookieJar#4009 (1) {
      │   protected $cookieJar =>
      │   array(1) {
      │     'localhost' =>
      │     array(1) {
      │       '/' =>
      │       array(2) {
      │         ...
      │       }
      │     }
      │   }
      │ }
      │ 
    Then the response status code should be 201 # Behat\MinkExtension\Context\MinkContext::assertResponseStatus()
    When I send a "GET" request to "/rest/contacts/3" # Behatch\Context\RestContext::iSendARequestTo()
      │ fabpot/goutte/Goutte/Client.php:128:
      │ class Symfony\Component\BrowserKit\CookieJar#4009 (1) {
      │   protected $cookieJar =>
      │   array(0) {
      │   }
      │ }

Does i miss something here? Any help is welcome. For your record, i checked the cookie's expiration but it is not expired.

0 Answers
Related