Added get_or_create_session helper to Request.

This commit is contained in:
Relintai 2021-08-05 19:34:11 +02:00
parent 0b0d2e5046
commit 711d1eed6f
2 changed files with 14 additions and 0 deletions

View File

@ -5,6 +5,18 @@
#include "http_session.h"
#include "session_manager.h"
HTTPSession *Request::get_or_create_session() {
if (session) {
return session;
}
session = SessionManager::get_singleton()->create_session();
return session;
}
const std::string &Request::get_cookie(const std::string &key) {
}

View File

@ -39,6 +39,8 @@ public:
HTTPSession *session;
std::map<std::string, Object *> data;
HTTPSession *get_or_create_session();
virtual const std::string &get_cookie(const std::string &key);
virtual void add_cookie(const ::Cookie &cookie);
virtual void remove_cookie(const std::string &key);