diff --git a/src/ESPAsyncWebServer.h b/src/ESPAsyncWebServer.h index c192dcf..eb28239 100644 --- a/src/ESPAsyncWebServer.h +++ b/src/ESPAsyncWebServer.h @@ -163,6 +163,7 @@ class AsyncWebServerRequest { void send(FS &fs, String path, String contentType=String(), bool download=false); void send(Stream &stream, String contentType, size_t len); void send(String contentType, size_t len, AwsResponseFiller callback); + void sendChunked(String contentType, AwsResponseFiller callback); AsyncWebServerResponse *beginResponse(int code, String contentType=String(), String content=String()); AsyncWebServerResponse *beginResponse(FS &fs, String path, String contentType=String(), bool download=false); diff --git a/src/WebServerClient.cpp b/src/WebServerClient.cpp index d756499..f6e66a5 100644 --- a/src/WebServerClient.cpp +++ b/src/WebServerClient.cpp @@ -635,21 +635,25 @@ AsyncResponseStream * AsyncWebServerRequest::beginResponseStream(String contentT } void AsyncWebServerRequest::send(int code, String contentType, String content){ - send(new AsyncBasicResponse(code, contentType, content)); + send(beginResponse(code, contentType, content)); } void AsyncWebServerRequest::send(FS &fs, String path, String contentType, bool download){ if(fs.exists(path) || (!download && fs.exists(path+".gz"))){ - send(new AsyncFileResponse(fs, path, contentType, download)); + send(beginResponse(fs, path, contentType, download)); } else send(404); } void AsyncWebServerRequest::send(Stream &stream, String contentType, size_t len){ - send(new AsyncStreamResponse(stream, contentType, len)); + send(beginResponse(stream, contentType, len)); } void AsyncWebServerRequest::send(String contentType, size_t len, AwsResponseFiller callback){ - send(new AsyncCallbackResponse(contentType, len, callback)); + send(beginResponse(contentType, len, callback)); +} + +void AsyncWebServerRequest::sendChunked(String contentType, AwsResponseFiller callback){ + send(beginChunkedResponse(contentType, callback)); }