/** * Returns a cookie specified by the given name * * This is a shortcut for $message->getHeaders()->getCookie($name); * * @param string $name Name of the cookie * @return \TYPO3\FLOW3\Http\Cookie The cookie or NULL if no such cookie exists * @api */ public function getCookie($name) { return $this->headers->getCookie($name); }
/** * @test */ public function cookiesCanBeSetThroughTheCookieHeader() { $headers = new Headers(); $headers->set('Cookie', array('cookie1=the+value+number+1; cookie2=the+value+number+2; Cookie-Thing3="' . urlencode('Fön + x = \'test\'') . '"')); $this->assertTrue($headers->hasCookie('cookie1')); $this->assertEquals('the value number 1', $headers->getCookie('cookie1')->getValue()); $this->assertTrue($headers->hasCookie('cookie2')); $this->assertEquals('the value number 2', $headers->getCookie('cookie2')->getValue()); $this->assertEquals('Fön + x = \'test\'', $headers->getCookie('Cookie-Thing3')->getValue()); }