mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-13 21:01:08 -04:00
so the result buffer/string wasn't being parsed by the json class because even using the "proper" ways of comparing the char * to "application/json" weren't working...ugh
This commit is contained in:
Vendored
+7
-7
@@ -30,7 +30,7 @@ namespace StellaBellum
|
||||
{
|
||||
class webAPI
|
||||
{
|
||||
public:
|
||||
public:
|
||||
// useragent
|
||||
std::string userAgent;
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace StellaBellum
|
||||
{
|
||||
if (!key.empty())
|
||||
{
|
||||
requestData[key] = value;
|
||||
this->requestData[key] = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -65,15 +65,15 @@ namespace StellaBellum
|
||||
// get json response slot
|
||||
template<typename T> T getRespValue(std::string slot)
|
||||
{
|
||||
if (!responseData.is_null() && !slot.empty() && responseData.count(slot))
|
||||
if (!this->responseData.is_null() && !slot.empty() && this->responseData.count(slot))
|
||||
{
|
||||
return responseData[slot].get<T>();
|
||||
return this->responseData[slot].get<T>();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return T(); // empty value of T
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
// json request data - object is serialized before sending, used with above setter template
|
||||
nlohmann::json requestData;
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace StellaBellum
|
||||
// json processor - string to json
|
||||
bool processJSON();
|
||||
|
||||
protected:
|
||||
protected:
|
||||
// http response code (200, 404, etc)
|
||||
long statusCode;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user