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:
DarthArgus
2016-08-20 13:44:33 +00:00
parent 5f0e741a72
commit f7d5eeb160
4 changed files with 79 additions and 70 deletions
+7 -7
View File
@@ -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;
};