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
13
src/main.cpp
13
src/main.cpp
|
@ -87,6 +87,17 @@ void setup()
|
|||
serializeJson(doc, 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);
|
||||
server.begin();
|
||||
Serial.println("Server started!");
|
||||
|
@ -95,4 +106,4 @@ void setup()
|
|||
void loop()
|
||||
{
|
||||
artnet.parse(); // check if artnet packet has come and execute callback
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue