Skip to content

Commit 2264a87

Browse files
feat: added removeRoutes and removeHandler methods
1 parent 575a415 commit 2264a87

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

libraries/WebServer/src/WebServer.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,12 @@ class WebServer {
147147
void on(const Uri &uri, THandlerFunction fn);
148148
void on(const Uri &uri, HTTPMethod method, THandlerFunction fn);
149149
void on(const Uri &uri, HTTPMethod method, THandlerFunction fn, THandlerFunction ufn); //ufn handles file uploads
150+
bool removeRoute(const char *uri);
151+
bool removeRoute(const char *uri, HTTPMethod method);
152+
bool removeRoute(const String &uri);
153+
bool removeRoute(const String &uri, HTTPMethod method);
150154
void addHandler(RequestHandler *handler);
155+
bool removeHandler(RequestHandler *handler);
151156
void serveStatic(const char *uri, fs::FS &fs, const char *path, const char *cache_header = NULL);
152157
void onNotFound(THandlerFunction fn); //called when handler is not assigned
153158
void onFileUpload(THandlerFunction ufn); //handle file uploads
@@ -230,6 +235,7 @@ class WebServer {
230235
return _currentClient.write_P(b, l);
231236
}
232237
void _addRequestHandler(RequestHandler *handler);
238+
bool _removeRequestHandler(RequestHandler *handler);
233239
void _handleRequest();
234240
void _finalizeResponse();
235241
bool _parseRequest(NetworkClient &client);

0 commit comments

Comments
 (0)