载入中...
搜索中...
未找到
HttpRequest.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include "NetTypes.h"
6
7#include <cstdint>
8#include <map>
9#include <memory>
10#include <string>
11#include <vector>
12
13namespace eve::data {
14class ByteData;
15}
16
17namespace eve::network {
18
19class Network;
20
27public:
29 HttpRequest(Network* net, std::string method, std::string url);
31 ~HttpRequest() = default;
32
34 void setHeader(std::string k, std::string v);
36 void setBody(eve::data::ByteData* data);
38 void setBodyString(std::string s);
40 void setTimeout(int ms);
42 void setVerifySsl(bool verify);
44 bool submit();
45
47 Network* network() const { return net_; }
48
49private:
50 Network* net_ = nullptr;
51 std::string method_;
52 std::string url_;
53 std::map<std::string, std::string> headers_;
54 std::shared_ptr<std::vector<char>> body_;
55 int timeoutMs_ = -1;
56 int verifySsl_ = -1; // -1 = use module default
57};
58
59} // namespace eve::network
const std::string & s
std::uint16_t method
#define EVENGINE_API_PLATFORM
Definition Export.h:107
float v
In-memory byte buffer implementing eve::Data (ref-counted).
Definition ByteData.h:13
Asynchronous HTTP request (Poco-based). Configure headers/body, call submit(), then receive the respo...
Definition HttpRequest.h:26
Network * network() const
Owning module.
Definition HttpRequest.h:47
~HttpRequest()=default
Http request.
Network module: TCP/UDP/HTTP factories, background worker, and completion event plumbing....
Definition Network.h:35