Minor cleanup of AsyncWebServer, removing unneeded casts. (#156)

This commit is contained in:
Trygve Laugstøl 2017-04-10 16:10:02 +02:00 committed by Me No Dev
parent ab61227a8a
commit 2c4128c7cd
2 changed files with 7 additions and 7 deletions

View File

@ -369,7 +369,7 @@ class AsyncWebServer {
AsyncServer _server;
LinkedList<AsyncWebRewrite*> _rewrites;
LinkedList<AsyncWebHandler*> _handlers;
AsyncWebHandler* _catchAllHandler;
AsyncCallbackWebHandler* _catchAllHandler;
public:
AsyncWebServer(uint16_t port);

View File

@ -163,15 +163,15 @@ AsyncStaticWebHandler& AsyncWebServer::serveStatic(const char* uri, fs::FS& fs,
}
void AsyncWebServer::onNotFound(ArRequestHandlerFunction fn){
((AsyncCallbackWebHandler*)_catchAllHandler)->onRequest(fn);
_catchAllHandler->onRequest(fn);
}
void AsyncWebServer::onFileUpload(ArUploadHandlerFunction fn){
((AsyncCallbackWebHandler*)_catchAllHandler)->onUpload(fn);
_catchAllHandler->onUpload(fn);
}
void AsyncWebServer::onRequestBody(ArBodyHandlerFunction fn){
((AsyncCallbackWebHandler*)_catchAllHandler)->onBody(fn);
_catchAllHandler->onBody(fn);
}
void AsyncWebServer::reset(){
@ -179,9 +179,9 @@ void AsyncWebServer::reset(){
_handlers.free();
if (_catchAllHandler != NULL){
((AsyncCallbackWebHandler*)_catchAllHandler)->onRequest(NULL);
((AsyncCallbackWebHandler*)_catchAllHandler)->onUpload(NULL);
((AsyncCallbackWebHandler*)_catchAllHandler)->onBody(NULL);
_catchAllHandler->onRequest(NULL);
_catchAllHandler->onUpload(NULL);
_catchAllHandler->onBody(NULL);
}
}