From 270730d9b36c8fc3a221da7e565632c1432d41c6 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Sun, 5 Jun 2022 21:41:57 -0400 Subject: start attachments (image paste and upload) --- src/http.hpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/http.hpp') 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 #include #include @@ -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 m_error_buf = { 0 }; + curl_mime *m_form = nullptr; }; using response_type = response; -- cgit v1.2.3