Skip to content

Commit f569077

Browse files
Implement POST in httplib
1 parent 2cb08ec commit f569077

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Controllers/NanoleafController/NanoleafController.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ long APIRequest(std::string method, std::string location, std::string URI, json*
5959
status = result->status;
6060
body = result->body;
6161
}
62+
else if(method == "POST")
63+
{
64+
httplib::Result result = client.Post(URI.c_str());
65+
66+
status = result->status;
67+
body = result->body;
68+
}
6269

6370
LOG_DEBUG("[Nanoleaf] Result %d %s", status, body.c_str());
6471

@@ -71,7 +78,7 @@ long APIRequest(std::string method, std::string location, std::string URI, json*
7178
}
7279
else
7380
{
74-
//LOG_DEBUG("[Nanoleaf] HTTP %i:Could not %s from %s", httpCode, method.c_str(), url.c_str());
81+
LOG_DEBUG("[Nanoleaf] HTTP %i:Could not %s from %s", status, method.c_str(), url.c_str());
7582
}
7683

7784
return status;

0 commit comments

Comments
 (0)