75
|
1 #ifndef __core__http_h
|
|
2 #define __core__http_h
|
|
3
|
|
4 #include <string>
|
|
5 #include <vector>
|
|
6 #include <QThread>
|
|
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
|
|
31 }
|
|
32
|
|
33 #endif // __core__http_h
|