Mercurial > minori
diff include/core/http.h @ 77:6f7385bd334c
*: update
formatted all source files, no more subclassing QThread... many other
changes :)
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Fri, 06 Oct 2023 06:18:53 -0400 |
parents | 3364fadc8a36 |
children | f5940a575d83 |
line wrap: on
line diff
--- a/include/core/http.h Wed Oct 04 01:46:33 2023 -0400 +++ b/include/core/http.h Fri Oct 06 06:18:53 2023 -0400 @@ -1,32 +1,14 @@ #ifndef __core__http_h #define __core__http_h -#include <QThread> +#include <QByteArray> #include <string> #include <vector> -class QObject; - namespace HTTP { -class HttpGetThread : public QThread { - Q_OBJECT - - public: - HttpGetThread(std::string url, std::vector<std::string> headers = {}, QObject* parent = nullptr); - - private: - static size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userdata); - void run() override; - std::string _url; - std::vector<std::string> _headers; - - signals: - void resultReady(const QByteArray& arr); -}; - -/* Performs a basic (blocking) post request */ -std::string PerformBasicPostRequest(std::string url, std::string data, std::vector<std::string> headers = {}); +QByteArray Get(std::string url, std::vector<std::string> headers = {}); +QByteArray Post(std::string url, std::string data, std::vector<std::string> headers = {}); } // namespace HTTP