diff options
| author | Zousar Shaker <[email protected]> | 2021-11-25 21:17:52 -0700 |
|---|---|---|
| committer | Zousar Shaker <[email protected]> | 2021-11-25 21:17:52 -0700 |
| commit | ad6de26b808d8b868b8cb621e77b0dd4689c9993 (patch) | |
| tree | 11551da315c50ef2dd8fe5adb4a9971dc71fa3b5 /zenhttp/httpserver.cpp | |
| parent | Fix asio bug where input of less than 16 bytes would not get consumed. (diff) | |
| download | zen-ad6de26b808d8b868b8cb621e77b0dd4689c9993.tar.xz zen-ad6de26b808d8b868b8cb621e77b0dd4689c9993.zip | |
Move HandlePackageOffers out of ifdef to fix static compile error.
Diffstat (limited to 'zenhttp/httpserver.cpp')
| -rw-r--r-- | zenhttp/httpserver.cpp | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/zenhttp/httpserver.cpp b/zenhttp/httpserver.cpp index dcf0a2765..7486e82e1 100644 --- a/zenhttp/httpserver.cpp +++ b/zenhttp/httpserver.cpp @@ -620,44 +620,6 @@ CreateHttpServer(std::string_view ServerClass) ////////////////////////////////////////////////////////////////////////// -#if ZEN_WITH_TESTS - -TEST_CASE("http.common") -{ - using namespace std::literals; - - SUBCASE("router") - { - HttpRequestRouter r; - r.AddPattern("a", "[[:alpha:]]+"); - r.RegisterRoute( - "{a}", - [&](auto) {}, - HttpVerb::kGet); - - // struct TestHttpServerRequest : public HttpServerRequest - //{ - // TestHttpServerRequest(std::string_view Uri) : m_uri{Uri} {} - //}; - - // TestHttpServerRequest req{}; - // r.HandleRequest(req); - } - - SUBCASE("content-type") - { - for (uint8_t i = 0; i < uint8_t(HttpContentType::kCOUNT); ++i) - { - HttpContentType Ct{i}; - - if (Ct != HttpContentType::kUnknownContentType) - { - CHECK_EQ(Ct, ParseContentType(MapContentTypeToString(Ct))); - } - } - } -} - bool HandlePackageOffers(HttpService& Service, HttpServerRequest& Request, Ref<IHttpPackageHandler>& PackageHandlerRef) { @@ -736,6 +698,46 @@ HandlePackageOffers(HttpService& Service, HttpServerRequest& Request, Ref<IHttpP return false; } +////////////////////////////////////////////////////////////////////////// + +#if ZEN_WITH_TESTS + +TEST_CASE("http.common") +{ + using namespace std::literals; + + SUBCASE("router") + { + HttpRequestRouter r; + r.AddPattern("a", "[[:alpha:]]+"); + r.RegisterRoute( + "{a}", + [&](auto) {}, + HttpVerb::kGet); + + // struct TestHttpServerRequest : public HttpServerRequest + //{ + // TestHttpServerRequest(std::string_view Uri) : m_uri{Uri} {} + //}; + + // TestHttpServerRequest req{}; + // r.HandleRequest(req); + } + + SUBCASE("content-type") + { + for (uint8_t i = 0; i < uint8_t(HttpContentType::kCOUNT); ++i) + { + HttpContentType Ct{i}; + + if (Ct != HttpContentType::kUnknownContentType) + { + CHECK_EQ(Ct, ParseContentType(MapContentTypeToString(Ct))); + } + } + } +} + void http_forcelink() { |