| 230 | |
| 231 | |
| 232 | Request::Request(string method, string url, const unordered_map<string, string>& headers, |
| 233 | vector<pair<string, string>> params, std::function<bool(size_t, size_t)> downloadProgress, |
| 234 | std::function<bool(size_t, size_t)> uploadProgress) : |
| 235 | m_method(method), |
| 236 | m_url(url), m_headers(headers), m_downloadProgress(downloadProgress), m_uploadProgress(uploadProgress) |
| 237 | { |
| 238 | if (!params.empty()) |
| 239 | { |
| 240 | m_url += "?"; |
| 241 | m_url += UrlEncode(params); |
| 242 | } |
| 243 | |
| 244 | if (m_headers.find("Content-Length") == m_headers.end()) |
| 245 | { |
| 246 | m_headers.insert({"Content-Length", to_string(m_body.size())}); |
| 247 | } |
| 248 | if (m_headers.find("Content-Type") == m_headers.end()) |
| 249 | { |
| 250 | m_headers.insert({"Content-Type", "application/octet-stream"}); |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | |
| 255 | Request::Request(string method, string url, const unordered_map<string, string>& headers, |