diff --git a/lib/inc/drogon/NotFound.h b/lib/inc/drogon/NotFound.h index b9b4bbbb..e4777cea 100644 --- a/lib/inc/drogon/NotFound.h +++ b/lib/inc/drogon/NotFound.h @@ -15,7 +15,12 @@ */ #include - +namespace drogon +{ +/** + * @brief This class is used by the drogon to generate the 404 page. Users don't + * use this class directly. + */ class NotFound : public drogon::DrTemplate { public: @@ -23,3 +28,4 @@ class NotFound : public drogon::DrTemplate virtual ~NotFound(){}; virtual std::string genText(const drogon::HttpViewData &) override; }; +} // namespace drogon diff --git a/lib/src/HttpResponseImpl.cc b/lib/src/HttpResponseImpl.cc index a71e5727..b0e2403b 100644 --- a/lib/src/HttpResponseImpl.cc +++ b/lib/src/HttpResponseImpl.cc @@ -78,8 +78,13 @@ HttpResponsePtr HttpResponse::newNotFoundResponse() std::call_once(once, []() { HttpViewData data; data.insert("version", getVersion()); - notFoundResp = HttpResponse::newHttpViewResponse("NotFound", data); + notFoundResp = + HttpResponse::newHttpViewResponse("drogon::NotFound", data); notFoundResp->setStatusCode(k404NotFound); + notFoundResp->setExpiredTime(0); + auto str = static_cast(notFoundResp.get()) + ->renderToString(); + LOG_TRACE << *str; }); return notFoundResp; }