From f569077c68421d41b4fde59150868bef9c69f301 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Tue, 3 May 2022 23:02:30 -0500 Subject: [PATCH] Implement POST in httplib --- Controllers/NanoleafController/NanoleafController.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Controllers/NanoleafController/NanoleafController.cpp b/Controllers/NanoleafController/NanoleafController.cpp index e96abf3f7..7d53e86c0 100644 --- a/Controllers/NanoleafController/NanoleafController.cpp +++ b/Controllers/NanoleafController/NanoleafController.cpp @@ -59,6 +59,13 @@ long APIRequest(std::string method, std::string location, std::string URI, json* status = result->status; body = result->body; } + else if(method == "POST") + { + httplib::Result result = client.Post(URI.c_str()); + + status = result->status; + body = result->body; + } LOG_DEBUG("[Nanoleaf] Result %d %s", status, body.c_str()); @@ -71,7 +78,7 @@ long APIRequest(std::string method, std::string location, std::string URI, json* } else { - //LOG_DEBUG("[Nanoleaf] HTTP %i:Could not %s from %s", httpCode, method.c_str(), url.c_str()); + LOG_DEBUG("[Nanoleaf] HTTP %i:Could not %s from %s", status, method.c_str(), url.c_str()); } return status;