function testBodyNotSentWhenHeadRequest() { $this->request->mock(array("REQUEST_METHOD" => "HEAD")); $this->response->setBody("abc"); $this->response->setHeader("Content-Length", 3); $this->assertEmpty("", $this->send()); $expected = array("HTTP/1.1 200 OK", "Date: " . $this->response->getHeader("Date")); $this->assertEquals($expected, HeaderStack::stack()); }
function testSendContentViaString() { $resp = new Response(); $resp->setBody($a = "Hello"); $this->assertSame($a, $resp->getBody()); }
function fail(Request $request, Response $response) { $response->setBody("failed"); return false; }