Browse Source

Fixed Unit test failures on Windows

yhirose 8 years ago
parent
commit
6a608b3ed4
2 changed files with 5 additions and 2 deletions
  1. 4 0
      httplib.h
  2. 1 2
      test/test.cc

+ 4 - 0
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;

+ 1 - 2
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)