| 116 | } |
| 117 | |
| 118 | void HttpHeaderProcessorTest::testGetHttpResponseHeader() |
| 119 | { |
| 120 | HttpHeaderProcessor proc(HttpHeaderProcessor::CLIENT_PARSER); |
| 121 | std::string hd = "HTTP/1.1 404 Not Found\r\n" |
| 122 | "Date: Mon, 25 Jun 2007 16:04:59 GMT\r\n" |
| 123 | "Server: Apache/2.2.3 (Debian)\r\n" |
| 124 | "Last-Modified: Tue, 12 Jun 2007 14:28:43 GMT\r\n" |
| 125 | "ETag: \"594065-23e3-50825cc0\"\r\n" |
| 126 | "Accept-Ranges: bytes\r\n" |
| 127 | "Content-Length: 9187\r\n" |
| 128 | "Connection: close\r\n" |
| 129 | "Content-Type: text/html; charset=UTF-8\r\n" |
| 130 | "\r\n" |
| 131 | "Content-Encoding: body"; |
| 132 | |
| 133 | CPPUNIT_ASSERT(proc.parse(hd)); |
| 134 | |
| 135 | auto header = proc.getResult(); |
| 136 | CPPUNIT_ASSERT_EQUAL(404, header->getStatusCode()); |
| 137 | CPPUNIT_ASSERT_EQUAL(std::string("Not Found"), header->getReasonPhrase()); |
| 138 | CPPUNIT_ASSERT_EQUAL(std::string("HTTP/1.1"), header->getVersion()); |
| 139 | CPPUNIT_ASSERT_EQUAL(std::string("9187"), |
| 140 | header->find(HttpHeader::CONTENT_LENGTH)); |
| 141 | CPPUNIT_ASSERT_EQUAL(std::string("text/html; charset=UTF-8"), |
| 142 | header->find(HttpHeader::CONTENT_TYPE)); |
| 143 | CPPUNIT_ASSERT(!header->defined(HttpHeader::CONTENT_ENCODING)); |
| 144 | } |
| 145 | |
| 146 | void HttpHeaderProcessorTest::testGetHttpResponseHeader_statusOnly() |
| 147 | { |
nothing calls this directly
no test coverage detected