@@ -35,18 +35,22 @@ namespace dpp {
35
35
static std::string http_version = " DiscordBot (https://github.com/brainboxdotcc/DPP, " + std::to_string(DPP_VERSION_MAJOR) + " ." + std::to_string(DPP_VERSION_MINOR) + " ." + std::to_string(DPP_VERSION_PATCH) + " )" ;
36
36
static const char * DISCORD_HOST = " https://discord.com" ;
37
37
38
- http_request::http_request (const std::string &_endpoint, const std::string &_parameters, http_completion_event completion, const std::string &_postdata, http_method _method, const std::string &audit_reason, const std::string &filename, const std::string &filecontent)
38
+ http_request::http_request (const std::string &_endpoint, const std::string &_parameters, http_completion_event completion, const std::string &_postdata, http_method _method, const std::string &audit_reason, const std::string &filename, const std::string &filecontent, const std::string &filemimetype )
39
39
: complete_handler(completion), completed(false ), non_discord(false ), endpoint(_endpoint), parameters(_parameters), postdata(_postdata), method(_method), reason(audit_reason), mimetype(" application/json" ), waiting(false )
40
40
{
41
41
if (!filename.empty ())
42
42
file_name.push_back (filename);
43
43
if (!filecontent.empty ())
44
44
file_content.push_back (filecontent);
45
+ if (!filemimetype.empty ())
46
+ file_mimetypes.push_back (filemimetype);
45
47
}
46
48
47
- http_request::http_request (const std::string &_endpoint, const std::string &_parameters, http_completion_event completion, const std::string &_postdata, http_method method, const std::string &audit_reason, const std::vector<std::string> &filename, const std::vector<std::string> &filecontent)
48
- : complete_handler(completion), completed(false ), non_discord(false ), endpoint(_endpoint), parameters(_parameters), postdata(_postdata), method(method), reason(audit_reason), file_name(filename), file_content(filecontent), mimetype(" application/json" ), waiting(false )
49
+ http_request::http_request (const std::string &_endpoint, const std::string &_parameters, http_completion_event completion, const std::string &_postdata, http_method method, const std::string &audit_reason, const std::vector<std::string> &filename, const std::vector<std::string> &filecontent, const std::vector<std::string> &filemimetypes )
50
+ : complete_handler(completion), completed(false ), non_discord(false ), endpoint(_endpoint), parameters(_parameters), postdata(_postdata), method(method), reason(audit_reason), file_name(filename), file_content(filecontent), file_mimetypes(filemimetypes), mimetype(" application/json" ), waiting(false )
49
51
{
52
+ if (filecontent.size () && !filemimetypes.size ())
53
+ std::cout << " hi" << std::endl;
50
54
}
51
55
52
56
@@ -167,7 +171,7 @@ http_request_completion_t http_request::run(cluster* owner) {
167
171
multipart = { postdata, " " };
168
172
} else {
169
173
170
- multipart = https_client::build_multipart (postdata, file_name, file_content);
174
+ multipart = https_client::build_multipart (postdata, file_name, file_content, file_mimetypes );
171
175
if (!multipart.mimetype .empty ()) {
172
176
headers.emplace (" Content-Type" , multipart.mimetype );
173
177
}
0 commit comments