示例#1
0
文件: Response.php 项目: seytar/psx
 /**
  * Converts the response object to an http response string
  *
  * @return string
  */
 public function toString()
 {
     $response = ResponseParser::buildStatusLine($this) . Http::$newLine;
     $headers = ResponseParser::buildHeaderFromMessage($this);
     foreach ($headers as $header) {
         $response .= $header . Http::$newLine;
     }
     $response .= Http::$newLine;
     $response .= (string) $this->getBody();
     return $response;
 }
示例#2
0
 public function testBuildStatusLineUnknownStausCodeWithReason()
 {
     $response = new Response();
     $response->setStatus(800, 'Foo');
     $this->assertEquals('HTTP/1.1 800 Foo', ResponseParser::buildStatusLine($response));
 }