Refine the streaming, add UT, add error handling.

This commit is contained in:
Chunting Gu
2019-08-09 16:10:16 +08:00
parent c669551552
commit feae9b7acc
17 changed files with 316 additions and 212 deletions
+17
View File
@@ -0,0 +1,17 @@
#include "gtest/gtest.h"
#include "webcc/response_builder.h"
// Empty body should also have `Content-Length` header.
TEST(ResponseBuilderTest, EmptyBody) {
using namespace webcc;
auto response = ResponseBuilder{}.OK()();
bool existed = false;
const auto& value = response->GetHeader(headers::kContentLength, &existed);
EXPECT_TRUE(existed);
EXPECT_EQ("0", value);
}