diff options
Diffstat (limited to 'include/tgbot/net/HttpClient.h')
-rw-r--r-- | include/tgbot/net/HttpClient.h | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/include/tgbot/net/HttpClient.h b/include/tgbot/net/HttpClient.h index 8d67891..62b1875 100644 --- a/include/tgbot/net/HttpClient.h +++ b/include/tgbot/net/HttpClient.h @@ -1,5 +1,6 @@ -/* + /* * Copyright (c) 2015 Oleg Morozenkov + * Copyright (c) 2018 Egor Pugin * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -25,39 +26,31 @@ #include <string> -#include <boost/asio.hpp> - #include "tgbot/net/Url.h" #include "tgbot/net/HttpReqArg.h" -#include "tgbot/net/HttpParser.h" namespace TgBot { /** * @brief This class makes http requests. - * + * * @ingroup net */ class HttpClient { public: - /** - * @brief Returns instance which lives during all application lifetime. - */ - static HttpClient& getInstance(); - - /** - * @brief Sends a request to the url. - * - * If there's no args specified, a GET request will be sent, otherwise a POST request will be sent. - * If at least 1 arg is marked as file, the content type of a request will be multipart/form-data, otherwise it will be application/x-www-form-urlencoded. - */ - std::string makeRequest(const Url& url, const std::vector<HttpReqArg>& args); - -private: - boost::asio::io_service _ioService; + virtual ~HttpClient() = default; + + /** + * @brief Sends a request to the url. + * + * If there's no args specified, a GET request will be sent, otherwise a POST request will be sent. + * If at least 1 arg is marked as file, the content type of a request will be multipart/form-data, otherwise it will be application/x-www-form-urlencoded. + */ + virtual std::string makeRequest(const Url& url, const std::vector<HttpReqArg>& args) const = 0; }; } + #endif //TGBOT_HTTPCLIENT_H |