This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Description
EDIT: This may be of lesser priority if #191 can be solved.
Assume I have an API endpoint /api/files/local that can be called with or without FILE.
The documentation says:
//Check if POST (but not File) parameter exists
if(request->hasParam("download", true))
AsyncWebParameter* p = request->getParam("download", true);
//Check if FILE was uploaded
if(request->hasParam("download", true, true))
AsyncWebParameter* p = request->getParam("download", true, true);
But the documentation does not say how to handle these two cases.
Consider this code:
server.on("/api/files/local", HTTP_POST, [](AsyncWebServerRequest * request) {
if(!request->hasParam("file", true, true)){
// Need handleBody?
// To call handleBody instead of handleUpload, we need a filter since we can only hardwire one handler to server.on. How to do this?
}
request->send(200, "application/json", "{}");
}, handleUpload);
How can I make the upload work with handleUpload or handleBody depending on what the client sends?