mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-13 06:04:42 +02:00
define HTTP request methods at module level outside of class
This is a refactor to prepare for matching the API of HTTPRequest definitions in both namespaces http_bitcoin and http_libevent. In particular, to provide a consistent return type for GetRequestMethod() in both classes.
This commit is contained in:
@@ -45,6 +45,14 @@ struct evhttp_request;
|
||||
struct event_base;
|
||||
class CService;
|
||||
|
||||
enum class HTTPRequestMethod {
|
||||
UNKNOWN,
|
||||
GET,
|
||||
POST,
|
||||
HEAD,
|
||||
PUT
|
||||
};
|
||||
|
||||
namespace http_libevent {
|
||||
class HTTPRequest;
|
||||
|
||||
@@ -96,14 +104,6 @@ public:
|
||||
explicit HTTPRequest(struct evhttp_request* req, const util::SignalInterrupt& interrupt, bool replySent = false);
|
||||
~HTTPRequest();
|
||||
|
||||
enum RequestMethod {
|
||||
UNKNOWN,
|
||||
GET,
|
||||
POST,
|
||||
HEAD,
|
||||
PUT
|
||||
};
|
||||
|
||||
/** Get requested URI.
|
||||
*/
|
||||
std::string GetURI() const;
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
|
||||
/** Get request method.
|
||||
*/
|
||||
RequestMethod GetRequestMethod() const;
|
||||
HTTPRequestMethod GetRequestMethod() const;
|
||||
|
||||
/** Get the query parameter value from request uri for a specified key, or std::nullopt if the
|
||||
* key is not found.
|
||||
@@ -287,7 +287,7 @@ class HTTPRemoteClient;
|
||||
class HTTPRequest
|
||||
{
|
||||
public:
|
||||
std::string m_method;
|
||||
HTTPRequestMethod m_method;
|
||||
std::string m_target;
|
||||
HTTPVersion m_version;
|
||||
HTTPHeaders m_headers;
|
||||
|
||||
Reference in New Issue
Block a user