Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possbile fix for #941 #944

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions include/crow/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion tests/unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Loading