/** * 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; }
public function testBuildStatusLineUnknownStausCodeWithReason() { $response = new Response(); $response->setStatus(800, 'Foo'); $this->assertEquals('HTTP/1.1 800 Foo', ResponseParser::buildStatusLine($response)); }