Example #1
0
 /**
  * Test parsing headers and capturing content
  *
  * @return void
  */
 public function testHeaderParsing()
 {
     $headers = ['HTTP/1.0 200 OK', 'Content-Type : text/html;charset="UTF-8"', 'date: Tue, 25 Dec 2012 04:43:47 GMT'];
     $response = new Response($headers, 'ok');
     $this->assertEquals('1.0', $response->version());
     $this->assertEquals(200, $response->statusCode());
     $this->assertEquals('text/html;charset="UTF-8"', $response->header('content-type'));
     $this->assertEquals('Tue, 25 Dec 2012 04:43:47 GMT', $response->header('Date'));
     $this->assertEquals('text/html;charset="UTF-8"', $response->headers['Content-Type']);
     $this->assertTrue(isset($response->headers));
     $headers = ['HTTP/1.0 200'];
     $response = new Response($headers, 'ok');
     $this->assertEquals('1.0', $response->version());
     $this->assertEquals(200, $response->statusCode());
 }