diff --git a/example/Makefile b/example/Makefile index becc4c9..750122e 100644 --- a/example/Makefile +++ b/example/Makefile @@ -1,7 +1,7 @@ CC = clang++ CFLAGS = -std=c++14 -I.. -#OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib -lssl -lcrypto +OPENSSL_SUPPORT = -DCPPHTTPLIB_OPENSSL_SUPPORT -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib -lssl -lcrypto all: server client hello simplesvr diff --git a/example/server.cc b/example/server.cc index b5e9aad..b6e348d 100644 --- a/example/server.cc +++ b/example/server.cc @@ -34,7 +34,7 @@ std::string log(const Request& req, const Response& res) s += "================================\n"; - snprintf(buf, sizeof(buf), "%s %s", req.method.c_str(), req.url.c_str()); + snprintf(buf, sizeof(buf), "%s %s", req.method.c_str(), req.path.c_str()); s += buf; std::string query; diff --git a/test/test.cc b/test/test.cc index fea9fbe..8632368 100644 --- a/test/test.cc +++ b/test/test.cc @@ -267,7 +267,17 @@ TEST_F(ServerTest, GetMethodDir) ASSERT_TRUE(res != nullptr); EXPECT_EQ(200, res->status); EXPECT_EQ("text/html", res->get_header_value("Content-Type")); - EXPECT_EQ("index.html", res->body); + + auto body = R"( + + + + Test + hi + + +)"; + EXPECT_EQ(body, res->body); } TEST_F(ServerTest, GetMethodDirTest) diff --git a/test/www/dir/index.html b/test/www/dir/index.html index 64233a9..be3c05f 100644 --- a/test/www/dir/index.html +++ b/test/www/dir/index.html @@ -1 +1,8 @@ -index.html \ No newline at end of file + + + + + Test + hi + +