diff --git a/include/crow/app.h b/include/crow/app.h index 25592da69..79fdad59b 100644 --- a/include/crow/app.h +++ b/include/crow/app.h @@ -460,8 +460,8 @@ namespace crow } #endif - /// \brief Apply blueprints - void add_blueprint() + /// \brief Apply blueprints static routes + void add_blueprint_static_dirs() { #if defined(__APPLE__) || defined(__MACH__) if (router_.blueprints().empty()) return; @@ -480,9 +480,7 @@ namespace crow res.set_static_file_info_unsafe(static_dir_ + file_path_partial); res.end(); }); - } - - router_.validate_bp(); + } } /// \brief Go through the rules, upgrade them if possible, and add them to the list of rules @@ -502,14 +500,15 @@ namespace crow /// \brief A wrapper for `validate()` in the router void validate() { - router_.validate(); + router_.validate_bp(); + router_.validate(); } /// \brief Run the server void run() { #ifndef CROW_DISABLE_STATIC_DIR - add_blueprint(); + add_blueprint_static_dirs(); add_static_dir(); #endif validate(); diff --git a/tests/unittest.cpp b/tests/unittest.cpp index 53f083c07..bcb5f9624 100644 --- a/tests/unittest.cpp +++ b/tests/unittest.cpp @@ -3643,7 +3643,7 @@ TEST_CASE("blueprint") bp.register_blueprint(sub_bp); sub_bp.register_blueprint(sub_sub_bp); - app.add_blueprint(); + app.add_blueprint_static_dirs(); app.add_static_dir(); app.validate();