| 75 | 1 #ifndef __core__http_h | 
|  | 2 #define __core__http_h | 
|  | 3 | 
| 76 | 4 #include <QThread> | 
| 75 | 5 #include <string> | 
|  | 6 #include <vector> | 
|  | 7 | 
|  | 8 class QObject; | 
|  | 9 | 
|  | 10 namespace HTTP { | 
|  | 11 | 
|  | 12 class HttpGetThread : public QThread { | 
|  | 13 		Q_OBJECT | 
|  | 14 | 
|  | 15 	public: | 
|  | 16 		HttpGetThread(std::string url, std::vector<std::string> headers = {}, QObject* parent = nullptr); | 
|  | 17 | 
|  | 18 	private: | 
|  | 19 		static size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userdata); | 
|  | 20 		void run() override; | 
|  | 21 		std::string _url; | 
|  | 22 		std::vector<std::string> _headers; | 
|  | 23 | 
|  | 24 	signals: | 
|  | 25 		void resultReady(const QByteArray& arr); | 
|  | 26 }; | 
|  | 27 | 
|  | 28 /* Performs a basic (blocking) post request */ | 
|  | 29 std::string PerformBasicPostRequest(std::string url, std::string data, std::vector<std::string> headers = {}); | 
|  | 30 | 
| 76 | 31 } // namespace HTTP | 
| 75 | 32 | 
|  | 33 #endif // __core__http_h |