示例#1
0
 function testCanParseChallenge()
 {
     $headers = new SimpleHttpHeaders("HTTP/1.1 401 Authorization required\r\n" . "Content-Type: text/plain\r\n" . "Connection: close\r\n" . "WWW-Authenticate: Basic realm=\"Somewhere\"");
     $this->assertEqual($headers->getAuthentication(), 'Basic');
     $this->assertEqual($headers->getRealm(), 'Somewhere');
     $this->assertTrue($headers->isChallenge());
 }
示例#2
0
 function testRedirect()
 {
     $headers = new SimpleHttpHeaders("HTTP/1.1 301 OK\r\n" . "Content-Type: text/plain\r\n" . "Content-Length: 0\r\n" . "Location: http://www.somewhere-else.com/\r\n" . "Connection: close");
     $this->assertIdentical($headers->getResponseCode(), 301);
     $this->assertEqual($headers->getLocation(), "http://www.somewhere-else.com/");
     $this->assertTrue($headers->isRedirect());
 }