add chunked to simple sends
This commit is contained in:
parent
31a699a46f
commit
3cdefde295
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue