mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2025-05-19 10:32:56 +00:00
added callback for request body
This commit is contained in:
parent
705f202650
commit
106dbaf975
1 changed files with 12 additions and 1 deletions
11
src/main.cpp
11
src/main.cpp
|
@ -87,6 +87,17 @@ void setup()
|
||||||
serializeJson(doc, jsonString);
|
serializeJson(doc, jsonString);
|
||||||
|
|
||||||
request->send(200, "application/json", jsonString); });
|
request->send(200, "application/json", jsonString); });
|
||||||
|
|
||||||
|
server.onRequestBody([](AsyncWebServerRequest *request, uint8_t *data, size_t len, size_t index, size_t total)
|
||||||
|
{
|
||||||
|
if (request->url() == "/config" && request->method() == HTTP_PUT) {
|
||||||
|
Serial.printf("[REQUEST]\t%s\r\n", (const char *)data);
|
||||||
|
|
||||||
|
StaticJsonDocument<256> doc;
|
||||||
|
deserializeJson(doc, data);
|
||||||
|
request->send(200);
|
||||||
|
} });
|
||||||
|
|
||||||
delay(1000);
|
delay(1000);
|
||||||
server.begin();
|
server.begin();
|
||||||
Serial.println("Server started!");
|
Serial.println("Server started!");
|
||||||
|
|
Loading…
Add table
Reference in a new issue