/** * @memcheck */ public function testToString() { $body = "...body content..."; $request_str = implode("\r\n", ["HTTP/1.1 100 Continue", "Server: ion", "Expires: -1", "Cookie: one=1", "Cookie: two=2", "Content-Length: " . strlen($body), "", $body]); $resp = Response::parse($request_str); $expected = implode("\r\n", ["HTTP/1.1 100 Continue", "Server: ion", "Expires: -1", "Cookie: one=1,two=2", "Content-Length: " . strlen($body), "", $body]); $this->assertEquals($expected, strval($resp)); }
/** * @param Request $request * @param \ION\Stream $socket * * @return Deferred */ public static function request(Request $request, Stream $socket) : Deferred { return Response::parse((yield $socket->write($request->build())->readLine("\r\n\r\n", Stream::MODE_TRIM_TOKEN, 8192)->timeout(30))); }