forked from me-no-dev/ESPAsyncWebServer
add chunked to simple sends
This commit is contained in:
@@ -163,6 +163,7 @@ class AsyncWebServerRequest {
|
|||||||
void send(FS &fs, String path, String contentType=String(), bool download=false);
|
void send(FS &fs, String path, String contentType=String(), bool download=false);
|
||||||
void send(Stream &stream, String contentType, size_t len);
|
void send(Stream &stream, String contentType, size_t len);
|
||||||
void send(String contentType, size_t len, AwsResponseFiller callback);
|
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(int code, String contentType=String(), String content=String());
|
||||||
AsyncWebServerResponse *beginResponse(FS &fs, String path, String contentType=String(), bool download=false);
|
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){
|
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){
|
void AsyncWebServerRequest::send(FS &fs, String path, String contentType, bool download){
|
||||||
if(fs.exists(path) || (!download && fs.exists(path+".gz"))){
|
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);
|
} else send(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsyncWebServerRequest::send(Stream &stream, String contentType, size_t len){
|
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){
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user