2023-09-16 16:29:03 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Cookie.h"
|
|
|
|
#include "Http.h"
|
|
|
|
#include "ParameterValue.h"
|
|
|
|
#include "Session.h"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace VWeb {
|
|
|
|
struct Request {
|
|
|
|
public:
|
|
|
|
int ID;
|
|
|
|
std::string Body;
|
|
|
|
HttpMethod Method{HttpMethod::GET};
|
|
|
|
std::string URI;
|
|
|
|
Ref<Session> SessionData;
|
|
|
|
Ref<Cookies> CookieData;
|
|
|
|
Cookie &GetCookie(const std::string &key) { return CookieData->Get(key); };
|
|
|
|
ParameterValue &Parameter(const std::string &key) { return Parameters[key]; }
|
|
|
|
bool HasParameter(const std::string &key) const {
|
|
|
|
return Parameters.contains(key);
|
|
|
|
}
|
|
|
|
bool HasHeader(const std::string &key) const { return Headers.contains(key); }
|
|
|
|
std::string &FirstOf(const std::string &key) {
|
|
|
|
return Parameters[key].GetFirst();
|
|
|
|
}
|
|
|
|
ParameterValue &Header(const std::string &key) { return Headers[key]; }
|
|
|
|
std::unordered_map<std::string, ParameterValue> Parameters;
|
|
|
|
std::unordered_map<std::string, ParameterValue> Headers;
|
2024-04-16 20:09:22 +02:00
|
|
|
std::unordered_map<std::string, std::string> URLParameters;
|
2023-09-16 16:29:03 +02:00
|
|
|
};
|
|
|
|
} // namespace VWeb
|