23 #ifndef TGBOT_HTTPPARSER_H 24 #define TGBOT_HTTPPARSER_H 40 std::string
generateRequest(
const Url& url,
const std::vector<HttpReqArg>& args,
bool isKeepAlive =
false);
44 std::string
generateResponse(
const std::string& data,
const std::string& mimeType =
"text/plain",
short unsigned statusCode = 200,
const std::string& statusStr =
"OK",
bool isKeepAlive =
false);
46 inline std::string
parseRequest(
const std::string& data, std::map<std::string, std::string>& headers) {
47 return parseHttp(
true, data, headers);
51 return parseHttp(
true, data);
54 inline std::string
parseResponse(
const std::string& data, std::map<std::string, std::string>& headers) {
55 return parseHttp(
false, data, headers);
59 return parseHttp(
false, data);
63 std::string parseHttp(
bool isRequest,
const std::string& data, std::map<std::string, std::string>& headers);
64 std::string parseHttp(
bool isRequest,
const std::string& data);
69 #endif //TGBOT_HTTPPARSER_H std::string parseResponse(const std::string &data)
std::string generateWwwFormUrlencoded(const std::vector< HttpReqArg > &args)
std::string parseResponse(const std::string &data, std::map< std::string, std::string > &headers)
std::string generateMultipartFormData(const std::vector< HttpReqArg > &args, const std::string &bondary)
std::string generateMultipartBoundary(const std::vector< HttpReqArg > &args)
std::string generateResponse(const std::string &data, const std::string &mimeType="text/plain", short unsigned statusCode=200, const std::string &statusStr="OK", bool isKeepAlive=false)
static HttpParser & getInstance()
std::string parseRequest(const std::string &data)
This class parses a string with the url.
std::string parseRequest(const std::string &data, std::map< std::string, std::string > &headers)
std::string generateRequest(const Url &url, const std::vector< HttpReqArg > &args, bool isKeepAlive=false)