mirror of
https://github.com/Syping/dtranslatebot.git
synced 2026-04-01 05:20:22 +02:00
http_request: return const http_response in get post functions
This commit is contained in:
parent
ee245fbb79
commit
7588ca865b
2 changed files with 4 additions and 4 deletions
|
|
@ -24,7 +24,7 @@ http_request::http_request() {
|
|||
throw std::bad_alloc();
|
||||
}
|
||||
|
||||
http_response http_request::get(const std::string &url, const dpp::http_headers &headers) {
|
||||
const http_response http_request::get(const std::string &url, const dpp::http_headers &headers) {
|
||||
http_response response;
|
||||
curl_easy_setopt(instance, CURLOPT_URL, url.c_str());
|
||||
curl_slist *header_slist = nullptr;
|
||||
|
|
@ -50,7 +50,7 @@ http_response http_request::get(const std::string &url, const dpp::http_headers
|
|||
return response;
|
||||
}
|
||||
|
||||
http_response http_request::post(const std::string &url, const std::string &content, const std::string &content_type, const dpp::http_headers &headers) {
|
||||
const http_response http_request::post(const std::string &url, const std::string &content, const std::string &content_type, const dpp::http_headers &headers) {
|
||||
http_response response;
|
||||
curl_easy_setopt(instance, CURLOPT_URL, url.c_str());
|
||||
curl_slist *header_slist = nullptr;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ class http_request
|
|||
public:
|
||||
http_request();
|
||||
~http_request();
|
||||
http_response get(const std::string &url, const dpp::http_headers &headers = {});
|
||||
http_response post(const std::string &url, const std::string &content, const std::string &content_type, const dpp::http_headers &headers = {});
|
||||
const http_response get(const std::string &url, const dpp::http_headers &headers = {});
|
||||
const http_response post(const std::string &url, const std::string &content, const std::string &content_type, const dpp::http_headers &headers = {});
|
||||
static std::string legacy_url(const std::string &hostname, uint16_t port, const std::string &url, bool tls);
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue