Nui
fetch_options.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cstdint>
4 #include <string>
5 #include <unordered_map>
6 
7 #pragma clang diagnostic push
8 #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
9 #pragma clang diagnostic ignored "-Wold-style-cast"
10 #include <boost/describe.hpp>
11 #include <boost/mp11/algorithm.hpp>
12 #pragma clang diagnostic pop
13 
14 namespace Nui
15 {
16  struct FetchOptions
17  {
18  std::string method = "GET";
19  std::unordered_map<std::string, std::string> headers = {};
20  std::string body = "";
21  bool verbose = false;
22  bool followRedirects = false;
23  long maxRedirects = 255;
24  bool autoReferer = false;
25  // body is encoded as base64 to get it through to the webview. setting this option preserves the body as base64
26  bool dontDecodeBody = false;
27  bool verifyPeer = true;
28  bool verifyHost = true;
29  };
32  (),
33  (method,
34  headers,
35  body,
36  verbose,
37  followRedirects,
38  maxRedirects,
39  autoReferer,
40  dontDecodeBody,
41  verifyPeer,
42  verifyHost));
43 
45  {
46  int32_t curlCode;
47  int32_t status;
48  int32_t proxyStatus;
49  uint32_t downloadSize;
50  std::string redirectUrl;
51  std::string body;
52  std::unordered_map<std::string, std::string> headers;
53  };
54  BOOST_DESCRIBE_STRUCT(FetchResponse, (), (curlCode, status, proxyStatus, downloadSize, redirectUrl, body, headers));
55 }
Definition: file_dialog.hpp:6
BOOST_DESCRIBE_STRUCT(FetchOptions,(),(method, headers, body, verbose, followRedirects, maxRedirects, autoReferer, dontDecodeBody, verifyPeer, verifyHost))
Definition: fetch_options.hpp:17
std::string body
Definition: fetch_options.hpp:20
std::unordered_map< std::string, std::string > headers
Definition: fetch_options.hpp:19
bool verifyHost
Definition: fetch_options.hpp:28
bool followRedirects
Definition: fetch_options.hpp:22
bool verifyPeer
Definition: fetch_options.hpp:27
bool autoReferer
Definition: fetch_options.hpp:24
bool verbose
Definition: fetch_options.hpp:21
bool dontDecodeBody
Definition: fetch_options.hpp:26
long maxRedirects
Definition: fetch_options.hpp:23
std::string method
Definition: fetch_options.hpp:18
Definition: fetch_options.hpp:45
uint32_t downloadSize
Definition: fetch_options.hpp:49
int32_t status
Definition: fetch_options.hpp:47
int32_t proxyStatus
Definition: fetch_options.hpp:48
int32_t curlCode
Definition: fetch_options.hpp:46
std::string body
Definition: fetch_options.hpp:51
std::string redirectUrl
Definition: fetch_options.hpp:50
std::unordered_map< std::string, std::string > headers
Definition: fetch_options.hpp:52