예제 #1
0
파일: CookieTest.php 프로젝트: wagnert/http
 public function testHttpCookieCreateFromRawSetCookieResponseHeaderWithHttpOnlyEnabled()
 {
     $cookieHeader = 'cookieName=value; Expires=asdfasdf; Version=1; Domain=test.local; Path=/; Secure; HttpOnly';
     // init cookie by raw header
     $cookie = HttpCookie::createFromRawSetCookieHeader($cookieHeader);
     $this->assertSame(true, $cookie->isHttpOnly());
 }
예제 #2
0
 /**
  * Parses the http set cookie header
  *
  * @param string $headerValue The header value with cookie info in it
  *
  * @return void
  */
 public function parseCookieHeaderValue($headerValue)
 {
     $request = $this->getRequest();
     // parse cookies and iterate over
     foreach (explode(';', $headerValue) as $cookieStr) {
         // check if cookieStr is no just a empty str
         if (strlen($cookieStr) > 0) {
             // add cookie object to request
             $request->addCookie(HttpCookie::createFromRawSetCookieHeader($cookieStr));
         }
     }
 }