summaryrefslogtreecommitdiffstats
path: root/src/lib/http/tests
diff options
context:
space:
mode:
authorMarcin Siodelski <marcin@isc.org>2018-05-30 11:00:50 +0200
committerMarcin Siodelski <marcin@isc.org>2018-05-30 11:00:50 +0200
commit2be44af3e8fe4419308c5c6b79c3a7c3490949d2 (patch)
treeda619992de26046324eb37f0ce4886a4f6212d7f /src/lib/http/tests
parent[5205] Unit tests for the HTTP message formatting. (diff)
downloadkea-2be44af3e8fe4419308c5c6b79c3a7c3490949d2.tar.xz
kea-2be44af3e8fe4419308c5c6b79c3a7c3490949d2.zip
[5205] Improved logging in the HTTP client class.
Diffstat (limited to 'src/lib/http/tests')
-rw-r--r--src/lib/http/tests/request_unittests.cc11
-rw-r--r--src/lib/http/tests/response_unittests.cc4
2 files changed, 13 insertions, 2 deletions
diff --git a/src/lib/http/tests/request_unittests.cc b/src/lib/http/tests/request_unittests.cc
index 51b692c6ac..dc350cdc27 100644
--- a/src/lib/http/tests/request_unittests.cc
+++ b/src/lib/http/tests/request_unittests.cc
@@ -272,4 +272,15 @@ TEST_F(HttpRequestTest, clientRequestNoBody) {
request_.toString());
}
+TEST_F(HttpRequestTest, toBriefString) {
+ // Create the request.
+ setContextBasics("POST", "/isc/org", HttpVersion(1, 1));
+ // Add headers.
+ request_.context()->headers_.push_back(HttpHeaderContext("Content-Type", "application/json"));
+ // Must be finalized before can be used.
+ ASSERT_NO_THROW(request_.finalize());
+ // Check that the brief string is correct.
+ EXPECT_EQ("POST /isc/org HTTP/1.1", request_.toBriefString());
+}
+
}
diff --git a/src/lib/http/tests/response_unittests.cc b/src/lib/http/tests/response_unittests.cc
index d6d1529be9..fc07dd27b9 100644
--- a/src/lib/http/tests/response_unittests.cc
+++ b/src/lib/http/tests/response_unittests.cc
@@ -40,11 +40,11 @@ public:
ASSERT_NO_THROW(response.finalize());
std::ostringstream response_string;
response_string << "HTTP/1.0 " << static_cast<uint16_t>(status_code)
- << " " << status_message << "\r\n";
+ << " " << status_message;
EXPECT_EQ(response_string.str(), response.toBriefString());
response_string
- << "Content-Length: 0\r\n"
+ << "\r\nContent-Length: 0\r\n"
<< "Content-Type: text/html\r\n"
<< "Date: " << response.getDateHeaderValue() << "\r\n\r\n";
EXPECT_EQ(response_string.str(), response.toString());