From d1a031f1714f8ac437a809f23b988da9346fdf5e Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 22 Jun 2016 22:45:01 +0100 Subject: An empty set of default routes for all methods --- icespider/core/core.cpp | 4 ++-- icespider/unittests/testApp.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/icespider/core/core.cpp b/icespider/core/core.cpp index 525a99f..ba236ac 100644 --- a/icespider/core/core.cpp +++ b/icespider/core/core.cpp @@ -8,8 +8,8 @@ namespace ba = boost::algorithm; namespace IceSpider { Core::Core() { - // Big enough to map all the request methods - routes.resize(UserIceSpider::HttpMethod::OPTIONS + 1); + // Big enough to map all the request methods (an empty of zero lenght routes as default) + routes.resize(UserIceSpider::HttpMethod::OPTIONS + 1, {{ }}); // Initialize routes for (const auto & rp : AdHoc::PluginManager::getDefault()->getAll()) { auto r = rp->implementation(); diff --git a/icespider/unittests/testApp.cpp b/icespider/unittests/testApp.cpp index e91f618..f79d331 100644 --- a/icespider/unittests/testApp.cpp +++ b/icespider/unittests/testApp.cpp @@ -25,15 +25,15 @@ BOOST_AUTO_TEST_CASE( testCoreSettings ) BOOST_REQUIRE_EQUAL(0, routes[HttpMethod::GET][1].size()); BOOST_REQUIRE_EQUAL(0, routes[HttpMethod::GET][2].size()); BOOST_REQUIRE_EQUAL(1, routes[HttpMethod::GET][3].size()); - BOOST_REQUIRE_EQUAL(0, routes[HttpMethod::HEAD].size()); + BOOST_REQUIRE_EQUAL(1, routes[HttpMethod::HEAD].size()); BOOST_REQUIRE_EQUAL(2, routes[HttpMethod::POST].size()); BOOST_REQUIRE_EQUAL(0, routes[HttpMethod::POST][0].size()); BOOST_REQUIRE_EQUAL(1, routes[HttpMethod::POST][1].size()); - BOOST_REQUIRE_EQUAL(0, routes[HttpMethod::PUT].size()); + BOOST_REQUIRE_EQUAL(1, routes[HttpMethod::PUT].size()); BOOST_REQUIRE_EQUAL(2, routes[HttpMethod::DELETE].size()); BOOST_REQUIRE_EQUAL(0, routes[HttpMethod::DELETE][0].size()); BOOST_REQUIRE_EQUAL(1, routes[HttpMethod::DELETE][1].size()); - BOOST_REQUIRE_EQUAL(0, routes[HttpMethod::OPTIONS].size()); + BOOST_REQUIRE_EQUAL(1, routes[HttpMethod::OPTIONS].size()); } class TestRequest : public IceSpider::IHttpRequest { -- cgit v1.2.3