#include namespace VWeb { void MiddleWareHandler::HandlePre(Ref &request) { for (auto &[key, middleWare] : m_MiddleWares) { middleWare->PreHandle(*request); } } void MiddleWareHandler::HandlePost(Ref &request, Ref &response) { for (auto &[key, middleWare] : m_MiddleWares) { middleWare->PostHandle(*request, *response); } } void MiddleWareHandler::Shutdown(Ref &request, Ref &response) { for (auto &[key, middleWare] : m_MiddleWares) { middleWare->Shutdown(*request, *response); } } Ref MiddleWareHandler::GetById(const char *id) { return m_MiddleWares[id]; } Ref MiddleWareHandler::SetById(const char *id, const Ref &middleWare) { m_MiddleWares[id] = middleWare; return middleWare; } void MiddleWareHandler::RemoveById(const char *id) { if (m_MiddleWares.contains(id)) m_MiddleWares.erase(id); } } // namespace VWeb