1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-26 07:02:15 +03:00

Implemented support for filters and removable routes in ESP8266WebServer (#9152)

* feat: added filters and removeable routes

* Update Filters.ino

* fix: clang-format

* chore: updated docs

* chore: updated doc

* fix: use new implementation

* fix: filters.ino example

* fix: filters.ino

* fix: formatting

* fix: formatting (2)
This commit is contained in:
Ayush Sharma
2024-06-15 23:50:13 +05:30
committed by GitHub
parent 685f2c97ff
commit 9afeaf5694
7 changed files with 317 additions and 30 deletions

View File

@ -54,8 +54,10 @@ Client request handlers
.. code:: cpp
void on();
RequestHandler<ServerType>& on();
bool removeRoute();
void addHandler();
bool removeHandler();
void onNotFound();
void onFileUpload();
@ -64,9 +66,26 @@ Client request handlers
.. code:: cpp
server.on("/", handlerFunction);
server.removeRoute("/"); // Removes any route which points to "/" and has HTTP_ANY attribute
server.removeRoute("/", HTTP_GET); // Removes any route which points to "/" and has HTTP_GET attribute
server.onNotFound(handlerFunction); // called when handler is not assigned
server.onFileUpload(handlerFunction); // handle file uploads
Client request filters
^^^^^^^^^^^^^^^^^^^^^^
.. code:: cpp
RequestHandler<ServerType>& setFilter();
*Example:*
More details about this in `Filters.ino` example.
.. code:: cpp
server.on("/", handlerFunction).setFilter(ON_AP_FILTER)
Sending responses to the client
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^