mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 17:28:29 +00:00
Fix #436
This commit is contained in:
parent
05e0253195
commit
ad9fd3bd93
2 changed files with 44 additions and 2 deletions
16
httplib.h
16
httplib.h
|
@ -604,6 +604,8 @@ public:
|
|||
|
||||
std::shared_ptr<Response> Head(const char *path, const Headers &headers);
|
||||
|
||||
std::shared_ptr<Response> Post(const char *path);
|
||||
|
||||
std::shared_ptr<Response> Post(const char *path, const std::string &body,
|
||||
const char *content_type);
|
||||
|
||||
|
@ -631,6 +633,8 @@ public:
|
|||
std::shared_ptr<Response> Post(const char *path, const Headers &headers,
|
||||
const MultipartFormDataItems &items);
|
||||
|
||||
std::shared_ptr<Response> Put(const char *path);
|
||||
|
||||
std::shared_ptr<Response> Put(const char *path, const std::string &body,
|
||||
const char *content_type);
|
||||
|
||||
|
@ -831,7 +835,7 @@ inline void Post(std::vector<Request> &requests, const char *path,
|
|||
req.method = "POST";
|
||||
req.path = path;
|
||||
req.headers = headers;
|
||||
req.headers.emplace("Content-Type", content_type);
|
||||
if (content_type) { req.headers.emplace("Content-Type", content_type); }
|
||||
req.body = body;
|
||||
requests.emplace_back(std::move(req));
|
||||
}
|
||||
|
@ -4030,7 +4034,7 @@ inline std::shared_ptr<Response> Client::send_with_content_provider(
|
|||
req.headers = headers;
|
||||
req.path = path;
|
||||
|
||||
req.headers.emplace("Content-Type", content_type);
|
||||
if (content_type) { req.headers.emplace("Content-Type", content_type); }
|
||||
|
||||
#ifdef CPPHTTPLIB_ZLIB_SUPPORT
|
||||
if (compress_) {
|
||||
|
@ -4222,6 +4226,10 @@ inline std::shared_ptr<Response> Client::Head(const char *path,
|
|||
return send(req, *res) ? res : nullptr;
|
||||
}
|
||||
|
||||
inline std::shared_ptr<Response> Client::Post(const char *path) {
|
||||
return Post(path, std::string(), nullptr);
|
||||
}
|
||||
|
||||
inline std::shared_ptr<Response> Client::Post(const char *path,
|
||||
const std::string &body,
|
||||
const char *content_type) {
|
||||
|
@ -4294,6 +4302,10 @@ Client::Post(const char *path, const Headers &headers,
|
|||
return Post(path, headers, body, content_type.c_str());
|
||||
}
|
||||
|
||||
inline std::shared_ptr<Response> Client::Put(const char *path) {
|
||||
return Put(path, std::string(), nullptr);
|
||||
}
|
||||
|
||||
inline std::shared_ptr<Response> Client::Put(const char *path,
|
||||
const std::string &body,
|
||||
const char *content_type) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue