From 30c37eb549c17b29a8131598cc06aeaf374896f5 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Tue, 28 Feb 2012 04:57:59 +0100 Subject: Having a slightly better approach for writing Http responses. --- tests/test-Http.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'tests') diff --git a/tests/test-Http.cc b/tests/test-Http.cc index e6ba38d..af78e43 100644 --- a/tests/test-Http.cc +++ b/tests/test-Http.cc @@ -13,12 +13,8 @@ class TestAction : public HttpServer::Action { }; bool TestAction::Do(HttpServer * server, Http::Request & req, HttpServer::Action::ActionMatch & match, IO out) throw (GeneralException) { - static const char str[] = -"HTTP/1.1 200 Found\r\n" -"Content-Type: text/html; charset=UTF-8\r\n" -"Content-Length: 266\r\n" -"Server: " DAEMON_NAME "\r\n" -"\r\n" + HttpServer::Response response(server, req, out); + response->writeString( "\n" "\n" @@ -29,9 +25,9 @@ bool TestAction::Do(HttpServer * server, Http::Request & req, HttpServer::Action " \n" " This is a test document.\n" " \n" -"\n"; +"\n"); - out->forceWrite(str, sizeof(str) - 1); + response.Flush(); return true; } -- cgit v1.2.3