! Structure containing HTTP metadata for requests */
| 189 | Structure containing HTTP metadata for requests |
| 190 | */ |
| 191 | struct Request |
| 192 | { |
| 193 | _STD_STRING m_method; |
| 194 | _STD_STRING m_url; |
| 195 | _STD_UNORDERED_MAP<_STD_STRING, _STD_STRING> m_headers; |
| 196 | _STD_VECTOR<uint8_t> m_body; |
| 197 | |
| 198 | std::function<bool(size_t, size_t)> m_downloadProgress; |
| 199 | std::function<bool(size_t, size_t)> m_uploadProgress; |
| 200 | |
| 201 | /*! |
| 202 | Construct an arbitrary HTTP request with an empty body |
| 203 | \param method Request method eg GET |
| 204 | \param url Target URL eg https://binary.ninja |
| 205 | \param headers Header keys/values |
| 206 | \param params Query parameters, keys/values |
| 207 | \param downloadProgress Function to call for download progress updates |
| 208 | \param uploadProgress Function to call for upload progress updates |
| 209 | */ |
| 210 | Request(_STD_STRING method, _STD_STRING url, const _STD_UNORDERED_MAP<_STD_STRING, _STD_STRING>& headers = {}, |
| 211 | _STD_VECTOR<std::pair<_STD_STRING, _STD_STRING>> params = {}, |
| 212 | std::function<bool(size_t, size_t)> downloadProgress = {}, |
| 213 | std::function<bool(size_t, size_t)> uploadProgress = {}); |
| 214 | |
| 215 | |
| 216 | /*! |
| 217 | Construct an arbitrary HTTP request with a binary data body |
| 218 | \param method Request method eg GET |
| 219 | \param url Target URL eg https://binary.ninja |
| 220 | \param headers Header keys/values |
| 221 | \param params Query parameters, keys/values |
| 222 | \param body Content body (binary data) |
| 223 | \param downloadProgress Function to call for download progress updates |
| 224 | \param uploadProgress Function to call for upload progress updates |
| 225 | */ |
| 226 | Request(_STD_STRING method, _STD_STRING url, const _STD_UNORDERED_MAP<_STD_STRING, _STD_STRING>& headers, |
| 227 | _STD_VECTOR<std::pair<_STD_STRING, _STD_STRING>> params, _STD_VECTOR<uint8_t> body, |
| 228 | std::function<bool(size_t, size_t)> downloadProgress = {}, |
| 229 | std::function<bool(size_t, size_t)> uploadProgress = {}); |
| 230 | |
| 231 | |
| 232 | /*! |
| 233 | Construct an arbitrary HTTP request with url encoded form fields as the body |
| 234 | \param method Request method eg GET |
| 235 | \param url Target URL eg https://binary.ninja |
| 236 | \param headers Header keys/values |
| 237 | \param params Query parameters, keys/values |
| 238 | \param formFields HTTP form fields, keys/values (both must be strings) |
| 239 | \param downloadProgress Function to call for download progress updates |
| 240 | \param uploadProgress Function to call for upload progress updates |
| 241 | */ |
| 242 | Request(_STD_STRING method, _STD_STRING url, const _STD_UNORDERED_MAP<_STD_STRING, _STD_STRING>& headers, |
| 243 | _STD_VECTOR<std::pair<_STD_STRING, _STD_STRING>> params, |
| 244 | _STD_VECTOR<std::pair<_STD_STRING, _STD_STRING>> formFields, |
| 245 | std::function<bool(size_t, size_t)> downloadProgress = {}, |
| 246 | std::function<bool(size_t, size_t)> uploadProgress = {}); |
| 247 | |
| 248 |