Add tests for static routes + support server.reload for static routes (#13643)

This commit is contained in:
Jarred Sumner
2024-08-31 03:32:08 -07:00
committed by GitHub
parent 9ba63eb522
commit 03de99afcf
7 changed files with 352 additions and 24 deletions

View File

@@ -514,6 +514,13 @@ public:
return std::move(*this);
}
void clearRoutes() {
if (httpContext) {
httpContext->getSocketContextData()->clearRoutes();
}
}
TemplatedApp &&head(std::string pattern, MoveOnlyFunction<void(HttpResponse<SSL> *, HttpRequest *)> &&handler) {
if (httpContext) {
httpContext->onHttp("HEAD", pattern, std::move(handler));

View File

@@ -50,6 +50,13 @@ private:
void *upgradedWebSocket = nullptr;
bool isParsingHttp = false;
bool rejectUnauthorized = false;
// TODO: SNI
void clearRoutes() {
this->router = HttpRouter<RouterData>{};
this->currentRouter = &router;
filterHandlers.clear();
}
};
}