1
0
mirror of synced 2025-07-29 11:01:13 +03:00
This commit is contained in:
yhirose
2025-05-25 21:56:28 -04:00
parent 4a7aae5469
commit 365cbe37fa
3 changed files with 104 additions and 5 deletions

View File

@ -285,6 +285,22 @@ svr.set_post_routing_handler([](const auto& req, auto& res) {
});
```
### Pre request handler
```cpp
svr.set_pre_request_handler([](const auto& req, auto& res) {
if (req.matched_route == "/user/:user") {
auto user = req.path_params.at("user");
if (user != "john") {
res.status = StatusCode::Forbidden_403;
res.set_content("error", "text/html");
return Server::HandlerResponse::Handled;
}
}
return Server::HandlerResponse::Unhandled;
});
```
### 'multipart/form-data' POST data
```cpp