mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-06-17 22:23:03 +00:00
fix compiler error, empty content_type does nothing now
This commit is contained in:
+3
-1
@@ -58,8 +58,10 @@ std::string GenericRequest(http::verb verb, const std::string& host, int port, c
|
|||||||
|
|
||||||
req.set(http::field::host, host);
|
req.set(http::field::host, host);
|
||||||
if (!body.empty()) {
|
if (!body.empty()) {
|
||||||
|
if (!ContentType.empty()) {
|
||||||
req.set(http::field::content_type, ContentType); // "application/json"
|
req.set(http::field::content_type, ContentType); // "application/json"
|
||||||
// "application/x-www-form-urlencoded"
|
// "application/x-www-form-urlencoded"
|
||||||
|
}
|
||||||
|
|
||||||
req.set(http::field::content_length, std::to_string(body.size()));
|
req.set(http::field::content_length, std::to_string(body.size()));
|
||||||
req.body() = body;
|
req.body() = body;
|
||||||
@@ -134,7 +136,7 @@ std::string GenericRequest(http::verb verb, const std::string& host, int port, c
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string Http::GET(const std::string& host, int port, const std::string& target, unsigned int* status) {
|
std::string Http::GET(const std::string& host, int port, const std::string& target, unsigned int* status) {
|
||||||
return GenericRequest(http::verb::get, host, port, target, {}, {}, content_type, status);
|
return GenericRequest(http::verb::get, host, port, target, {}, {}, "", status);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Http::POST(const std::string& host, int port, const std::string& target, const std::unordered_map<std::string, std::string>& fields, const std::string& body, const std::string& ContentType, unsigned int* status) {
|
std::string Http::POST(const std::string& host, int port, const std::string& target, const std::unordered_map<std::string, std::string>& fields, const std::string& body, const std::string& ContentType, unsigned int* status) {
|
||||||
|
|||||||
Reference in New Issue
Block a user