diff options
Diffstat (limited to 'src/http.hpp')
-rw-r--r-- | src/http.hpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/http.hpp b/src/http.hpp index 4220a6e..0c570db 100644 --- a/src/http.hpp +++ b/src/http.hpp @@ -1,4 +1,5 @@ #pragma once +#include <array> #include <string> #include <curl/curl.h> @@ -98,13 +99,24 @@ struct response { struct request { request(EMethod method, std::string url); + request(request &&other) noexcept; ~request(); + request(const request &) = delete; + request &operator=(const request &) = delete; + request &operator=(request &&) noexcept = delete; + + const std::string &get_url() const; + const char *get_method() const; + void set_verify_ssl(bool verify); void set_proxy(const std::string &proxy); void set_header(const std::string &name, const std::string &value); void set_body(const std::string &data); void set_user_agent(const std::string &data); + void make_form(); + void add_file(std::string_view name, std::string_view file_path, std::string_view filename); + void add_field(std::string_view name, const char *data, size_t size); response execute(); @@ -115,7 +127,8 @@ private: std::string m_url; const char *m_method; curl_slist *m_header_list = nullptr; - char m_error_buf[CURL_ERROR_SIZE] = { 0 }; + std::array<char, CURL_ERROR_SIZE> m_error_buf = { 0 }; + curl_mime *m_form = nullptr; }; using response_type = response; |