mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 11:05:08 -05:00
Compare commits
6 commits
d72ba7e48f
...
3dd01ab804
Author | SHA1 | Date | |
---|---|---|---|
|
3dd01ab804 | ||
|
1b5ae86f7b | ||
|
1f2aa2ced7 | ||
|
00e191accb | ||
|
58402e9b7b | ||
|
a5bbf6a40c |
2 changed files with 18 additions and 1 deletions
|
@ -113,7 +113,6 @@ namespace geode::utils::web {
|
|||
class Impl;
|
||||
|
||||
std::shared_ptr<Impl> m_impl;
|
||||
|
||||
public:
|
||||
WebRequest();
|
||||
~WebRequest();
|
||||
|
@ -253,6 +252,13 @@ namespace geode::utils::web {
|
|||
*/
|
||||
WebRequest& bodyJSON(matjson::Value const& json);
|
||||
|
||||
/**
|
||||
* Gets the unique request ID
|
||||
*
|
||||
* @return size_t
|
||||
*/
|
||||
size_t getID() const;
|
||||
|
||||
|
||||
/**
|
||||
* Gets the request method as a string
|
||||
|
|
|
@ -188,6 +188,8 @@ std::optional<float> WebProgress::uploadProgress() const {
|
|||
|
||||
class WebRequest::Impl {
|
||||
public:
|
||||
static std::atomic_size_t s_idCounter;
|
||||
|
||||
std::string m_method;
|
||||
std::string m_url;
|
||||
std::unordered_map<std::string, std::string> m_headers;
|
||||
|
@ -203,6 +205,9 @@ public:
|
|||
std::string m_CABundleContent;
|
||||
ProxyOpts m_proxyOpts = {};
|
||||
HttpVersion m_httpVersion = HttpVersion::DEFAULT;
|
||||
size_t m_id;
|
||||
|
||||
Impl() : m_id(s_idCounter++) {}
|
||||
|
||||
WebResponse makeError(int code, std::string const& msg) {
|
||||
auto res = WebResponse();
|
||||
|
@ -212,6 +217,8 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
std::atomic_size_t WebRequest::Impl::s_idCounter = 0;
|
||||
|
||||
WebRequest::WebRequest() : m_impl(std::make_shared<Impl>()) {}
|
||||
WebRequest::~WebRequest() {}
|
||||
|
||||
|
@ -584,6 +591,10 @@ WebRequest& WebRequest::bodyJSON(matjson::Value const& json) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
size_t WebRequest::getID() const {
|
||||
return m_impl->m_id;
|
||||
}
|
||||
|
||||
std::string WebRequest::getMethod() const {
|
||||
return m_impl->m_method;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue