From 6a608b3ed43aebdb23bf58bcd7ff65454e5fdc1f Mon Sep 17 00:00:00 2001 From: yhirose Date: Thu, 7 Dec 2017 00:05:43 -0500 Subject: [PATCH] Fixed Unit test failures on Windows --- httplib.h | 4 ++++ test/test.cc | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/httplib.h b/httplib.h index ad77c35..b5868be 100644 --- a/httplib.h +++ b/httplib.h @@ -1383,6 +1383,10 @@ inline bool Client::read_response_line(Stream& strm, Response& res) inline bool Client::send(const Request& req, Response& res) { + if (req.path.empty()) { + return false; + } + auto sock = detail::create_client_socket(host_.c_str(), port_); if (sock == -1) { return false; diff --git a/test/test.cc b/test/test.cc index ea4d268..2edf20e 100644 --- a/test/test.cc +++ b/test/test.cc @@ -392,8 +392,7 @@ TEST_F(ServerTest, InvalidBaseDir) TEST_F(ServerTest, EmptyRequest) { auto res = cli_.get(""); - ASSERT_TRUE(res != nullptr); - EXPECT_EQ(400, res->status); + ASSERT_TRUE(res == nullptr); } TEST_F(ServerTest, LongRequest)